Skip to contents

Use only inside the structural formula passed to repair() or repair_data(). Each reference selects one scalar coefficient, not a multi-column formula term. Inspect available names with repair_effects().

Usage

re(term, model = NULL, group = NULL)

Arguments

term

Random coefficient name, either a literal string (re("day")) or an unquoted name (re(day)). Names are read literally, without evaluating variables in the data or formula environment. Use backticks for nonsyntactic names, or keep the quoted form. Use "(Intercept)" for an intercept.

model

Name in the models list. May be omitted if unambiguous.

group

Target grouping-factor name from repair_effects(). May be omitted if the coefficient is unambiguous. Select one target group per model; other lmer groups must have every fitted level contained within that target.

Value

A formula marker; calling it outside a structural formula is an error.

Details

model is optional whenever the coefficient reference is unique; this includes a single MLM. One MLM can still contain several grouping factors with the same coefficient name, requiring group. With several MLMs, use model to resolve shared names. model and group must remain literal strings. Expressions such as re(get("day")) are not evaluated. If a variable term <- "day" exists, re(term) refers to a coefficient literally named term, not to day. Construct the formula explicitly when inserting programmatically chosen names.

Examples

equation <- re("day", model = "growth") ~ practice
equation
#> re("day", model = "growth") ~ practice
#> <environment: 0x55892f871a68>
concise <- re(day) ~ practice
concise
#> re(day) ~ practice
#> <environment: 0x55892f871a68>
# Use this formula with models = list(growth = your_fitted_model).