Chapter 7 Standardizing
7.1 Intro
Standardizing a variable means subtracting its mean from every data point in the data series, and dividing the resulting numbers by the variable’s standard deviation. The result is a variable with a mean of 0 and a standard deviation of 1.
7.3 Input: R
This stores the standardized values in a variable called xtcUsePillHigh_standardized
:
$xtcUsePillHigh_standardized <-
datscale(dat$xtcUsePillHigh);
In R is also easy to center a variable around its mean (i.e. omit the division by the standard deviation from the standardization procedure). The following command stores the centered values in a variable called xtcUsePillHigh_centered
:
$xtcUsePillHigh_centered <-
datscale(dat$xtcUsePillHigh, scale = FALSE);