Learn R Programming

lme4 (version 0.999375-37)

mcmcsamp: 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, ...)
## S3 method for class 'mer':
mcmcsamp(object, n, verbose, saveb, \dots)

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

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

Run the code above in your browser using DataLab