center {mlmpower} | R Documentation |
Center a data set based on a mp_data
Description
Provides multilevel centering of a mp_data
data set.
Usage
center(data, all = FALSE, ...)
Arguments
data |
|
all |
a logical value to center all variables based on model defaults |
... |
see details below |
Details
The ...
needs to be the variable's name followed by equals and the centering
strategy requested. There are three different strategies available:
-
cwc
= centering within cluster -
cgm
= centering with group mean -
none
= no centering
If all
is set to TRUE
then the default centering will be used unless
overwritten by specifying a specific centering strategy.
Value
For ndata = 1
a single data.frame
is returned.
If a list of data sets are included then they will be contained in a list
.
Each data.frame
has an additional center
attribute which denotes
the centering strategy used.
Examples
# Create Model
model <- (
outcome('Y')
+ within_predictor('X')
+ effect_size(icc = 0.1)
)
# Set seed
set.seed(198723)
# Create data set with default centering
model |> generate(5, 50) |> center(all = TRUE) -> mydata
# Create data centering X with cwc
model |> generate(5, 50) |> center(X = cwc) -> mydata
# See centering strategy
attr(mydata, 'center')
[Package mlmpower version 1.0.8 Index]