This function is superseded by the much more versatile
transform.scdf
function (see example below).
This function scales the measured values of an scdf file. It allows for mean
centering and standardization based on each single-case data set or a
scaling across all cases included in an scdf.
Arguments
- data
A single-case data frame. See
scdf()
to learn about this format.- var
A character string or a vector of character strings with variable names that should be scaled.
- center
If set TRUE, data are mean centered.
- scale
If set TRUE, the standard deviation is set.
- m
The target mean for centering.
- sd
The target standard deviation for scaling
- grand
If set TRUE, scaling is based on the mean and standard deviation of all values across all single-cases within the scdf.
See also
Other data manipulation functions:
add_l2()
,
as.data.frame.scdf()
,
as_scdf()
,
fill_missing()
,
moving_median()
,
outlier()
,
ranks()
,
rescale()
,
scdf()
,
select_cases()
,
set_vars()
,
shift()
,
smooth_cases()
,
truncate_phase()
Examples
## Standardize a multiple case scdf and compute an hplm
exampleAB_50 |>
standardize("values", center = TRUE, scale = TRUE) |>
hplm()
#> Hierarchical Piecewise Linear Regression
#>
#> Estimation method ML
#> Contrast model: W / level: first, slope: first
#> 50 Cases
#>
#> ICC = 0.287; L = 339.0; p = 0.000
#>
#> Fixed effects (values ~ 1 + mt + phaseB + interB)
#>
#> B SE df t p
#> Intercept -1.251 0.075 1328 -16.716 0
#> Trend mt 0.029 0.006 1328 5.006 0
#> Level phase B 0.708 0.033 1328 21.436 0
#> Slope phase B 0.046 0.006 1328 7.588 0
#>
#> Random effects (~1 | case)
#>
#> EstimateSD
#> Intercept 0.503
#> Residual 0.266
## The more versatile transform function supersedes standardize:
exampleAB_50 |>
transform(values = (values - mean(all(values))) / sd(all(values))) |>
hplm()
#> Hierarchical Piecewise Linear Regression
#>
#> Estimation method ML
#> Contrast model: W / level: first, slope: first
#> 50 Cases
#>
#> ICC = 0.287; L = 339.0; p = 0.000
#>
#> Fixed effects (values ~ 1 + mt + phaseB + interB)
#>
#> B SE df t p
#> Intercept -1.251 0.075 1328 -16.716 0
#> Trend mt 0.029 0.006 1328 5.006 0
#> Level phase B 0.708 0.033 1328 21.436 0
#> Slope phase B 0.046 0.006 1328 7.588 0
#>
#> Random effects (~1 | case)
#>
#> EstimateSD
#> Intercept 0.503
#> Residual 0.266