random_slope {mlmpower}R Documentation

Create a Random Slope in a Model

Description

Creates a random slope that can be added to a mp_model.

Usage

random_slope(name, weight = 1)

Arguments

name

a character string that references a variable's name

weight

a single numeric value specifying the variable's contribution to the variance explained metric. Weights are normalized across all variables of the same level.

Value

A mp_action that can be added to a mp_model.

Examples

# Create Model
model <- (
    outcome('Y')
    + within_predictor('X')
    + effect_size(
        icc = 0.1,
        within = 0.1,
        random_slope = 0.03
    )
)
# Add random slope to the model
model + random_slope('X')

[Package mlmpower version 1.0.8 Index]