mcmcsamp {lme4}R Documentation

Generate an MCMC sample

Description

This generic function generates a sample from the posterior distribution of the parameters of a fitted model using Markov Chain Monte Carlo methods.

Usage

mcmcsamp(object, n, verbose, ...)
## S4 method for signature 'mer':
mcmcsamp(object, n, verbose, saveb, ...)

Arguments

object An object of a suitable class - usually an "mer" object.
n integer - number of samples to generate. Defaults to 1.
verbose logical - if TRUE verbose output is printed. Defaults to FALSE.
saveb logical - if TRUE the values of the random effects are saved as part of the chain. Default is FALSE. Note that saving the random effects can require a considerable amount of memory. Use with caution.
... Some methods may take additional, optional arguments.

Value

An object of class "merMCMC" for which many methods are defined.

Examples

(fm1 <- lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject), sleepstudy))
set.seed(101); samp0 <- mcmcsamp(fm1, n = 1000)
str(samp0)

[Package lme4 version 0.999375-20 Index]