The function std accepts a design matrix and returns
a standardized version of that matrix (i.e., each column will have
mean 0 and mean sum of squares equal to 1).
Usage
std(X)
Arguments
X
A matrix (or object that can be coerced to a matrix,
such as a data frame).
Value
The standardized design matrix, with attribues "center" and "scale"
corresponding to the mean and (population) standard deviation used to
scale the columns.
Details
This function centers and scales each column of X so that
$$\sum_{i=1}^n x_{ij}=0$$
and
$$n^{-1} \sum_{i=1}^n x_{ij}^2 = 1$$
for all j. This is usually not necessary to call directly, as ncvreg
internally standardizes the design matrix, but inspection of the
standardized design matrix can sometimes be useful. This differs from
the base R function scale in two ways: (1) scale
uses the sample standard deviation sqrt(sum(x^2)/(n-1)), while
std uses the root-mean-square, or population, standard
deviation sqrt(mean(sum(x^2))), and (2) std is faster.