scale_dat: Scale features

Description Usage Arguments Value

View source: R/utility_funcs.r

Description

This define a function to scale features of a matrix with reference to another matrix useful because you can normalise X_train, and apply the same transformation to X_test. Use with caution if either dataset contain extreme outliers.

Usage

1
scale_dat(X, ref, na.rm = FALSE, add.intercept = TRUE)

Arguments

X

matrix of covariates.

ref

matrix of covariates from which to calculate mu and sd.

na.rm

a logical to indicate if NAs should be stripped in mean and standard deviation computations.

add.intercept

a logical to indicate if column of 1s should be added to the output (Intercept)

Value

augmented matrix of covariates, standardized and an intercept column


ant-stephenson/lhc documentation built on Jan. 28, 2021, 3:47 p.m.