| center | R Documentation |
mp_dataProvides multilevel centering of a mp_data data set.
center(data, all = FALSE, ...)
data |
a |
all |
a logical value to center all variables based on model defaults |
... |
see details below |
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.
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.
# 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')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.