Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

REsim

Simulate random effects from merMod REsim simulates random effects from merMod object posterior distributions


Description

Simulate random effects from merMod REsim simulates random effects from merMod object posterior distributions

Usage

REsim(merMod, n.sims = 200, oddsRatio = FALSE, seed = NULL)

Arguments

merMod

a merMod object from the lme4 package

n.sims

number of simulations to use

oddsRatio

logical, should parameters be converted to odds ratios?

seed

numeric, optional argument to set seed for simulations

Details

Use the Gelman sim technique to build empirical Bayes estimates. Uses the sim function in the arm package

Value

a data frame with the following columns

groupFctr

Name of the grouping factor

groupID

Level of the grouping factor

term

Name of random term (intercept/coefficient)

mean

Mean of the simulations

median

Median of the simulations

sd

Standard deviation of the simulations, NA if oddsRatio=TRUE

Examples

require(lme4)
m2 <- lmer(Reaction ~ Days + (Days | Subject), sleepstudy)
re2 <- REsim(m2, 25)
head(re2)

merTools

Tools for Analyzing Mixed Effect Regression Models

v0.5.2
GPL (>= 2)
Authors
Jared E. Knowles [aut, cre], Carl Frederick [aut], Alex Whitworth [ctb]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.