standardize: Standardize Data

Description Usage Arguments Value Author(s)

View source: R/utility_functions.R

Description

Function that standardizes the data before running the fitting algorithm. This is necessary in all penalization methods so that the effect of a given penalty is the same for each predictor. This is used in the shim function

Usage

1
standardize(x, y, center = TRUE, normalize = TRUE)

Arguments

x

Design matrix of dimension n x q, where n is the number of subjects and q is the total number of variables; each row is an observation vector. This must include all main effects and interactions as well, with column names corresponding to the names of the main effects (e.g. x1, x2, E) and their interactions (e.g. x1:E, x2:E). All columns should be scaled to have mean 0 and variance 1; this is done internally by the shim function.

y

response variable (matrix form) of dimension n x 1

normalize

Should x be scaled to have unit variance. Default is TRUE

intercept

Should x and y be centered. Default is TRUE

Value

list of length 5:

x

centered and normalized x matrix

y

centered y numeric vector

bx

numeric vector of column means of x matrix

by

mean of y

sx

standard deviations (using a divisor of n observations) of columns of x matrix

Author(s)

Sahir Bhatnagar

Maintainer: Sahir Bhatnagar sahir.bhatnagar@mail.mcgill.ca


sahirbhatnagar/shim documentation built on May 29, 2019, 12:59 p.m.