Scales a design matrix so that all non-categorical columns have a mean of 0 and an standard deviation of 1.
Details
The object initialisation is used to determine the relevant means and standard deviations to scale by and then the scaling (and un-scaling) itself is performed by the relevant object methods.
Un-scaling is done on linear model Beta and Sigma coefficients. For this purpose the first column on the dataset to be scaled is assumed to be the outcome variable with all other variables assumed to be post-transformation predictor variables (i.e. all dummy variables have already been expanded).
Public fields
centreVector of column means. The first value is the outcome variable, all other variables are the predictors.
scalesVector of column standard deviations. The first value is the outcome variable, all other variables are the predictors.
Methods
scaler$new()
Uses dat to determine the relevant column means and standard deviations to use
when scaling and un-scaling future datasets. Implicitly assumes that new datasets
have the same column order as dat
scaler$scale()
Scales a dataset so that all continuous variables have a mean of 0 and a standard deviation of 1.
scaler$unscale_sigma()
Unscales a sigma value (or matrix) as estimated by a linear model
using a design matrix scaled by this object. This function only
works if the first column of the initialisation data.frame was the outcome
variable.
scaler$unscale_beta()
Unscales a beta value (or vector) as estimated by a linear model
using a design matrix scaled by this object. This function only
works if the first column of the initialization data.frame was the outcome
variable.
