mlmpower {mlmpower}R Documentation

mlmpower Modeling Framework

Description

mlmpower constructs models by adding different features of the model using the plus sign (+).

Every model requires an outcome and an ICC specified in effect_size to be valid.

model <- outcome('y') + effect_size(icc = 0.1)

Once a model is constructed, we can add additional features to build the model out more. For example, we may want to include a level-1 predictor that is centered within cluster.

model <- model + within_predictor('x', icc = 0.0)

The additions can be chained together to produce the entire model object. For example, the previous two code blocks can be combined into one.

model <- (
    outcome('y')
    + effect_size(icc = 0.1)
    + within_predictor('x', icc = 0.0)
)

Finally, we can also wrap multiple variables into a list and add that. This feature can be useful when programmatically generating a model.

model <- (
    outcome('y')
    + effect_size(icc = 0.1)
    + lapply(1:10, \(i) within_predictor(paste0('x', i), icc = 0.0))
)

For more detailed information see the help vignette by running the following:

vignette('mlmpower')

See Also

Variables effect_size() correlations() random_slope() product()


[Package mlmpower version 1.0.8 Index]