add_ranef: Add random effects to a data frame

Description Usage Arguments Value Examples

View source: R/add_ranef.R

Description

Add random effects to a data frame

Usage

1
add_ranef(.data, .by = NULL, ..., .cors = 0, .empirical = FALSE)

Arguments

.data

the data frame

.by

the grouping column (groups by row if NULL)

...

the name and standard deviation of each random effect

.cors

the correlations among multiple random effects, to be passed to rnorm_multi as r

.empirical

logical. To be passed to rnorm_multi as empirical

Value

data frame with new random effects columns

Examples

1
2
3
4
add_random(rater = 2, stimulus = 2, time = 2) %>%
  add_ranef("rater", u0r = 1.5) %>%
  add_ranef("stimulus", u0s = 2.2, u1s = 0.75, .cors = 0.5) %>%
  add_ranef(c("rater", "stimulus"), u0sr = 1.2)

faux documentation built on Sept. 14, 2021, 1:08 a.m.