centreScaleCovariates: Centre and Scale Covariates

View source: R/mcmcInternals.R

centreScaleCovariatesR Documentation

Centre and Scale Covariates

Description

Centre and Scale Covariates

Usage

centreScaleCovariates(inData, centreCovs = TRUE, scaleCovs = TRUE)

Arguments

inData

A data.frame or object coercible to a data.frame containing the variables to centre and scale.

centreCovs

A logical scalar denoting whether the fixed effects in the model should be centred before the analysis: each covariate element is subtracted by its mean. centreCovs can also be a function with one argument that is a vector of covariate values. In this case the variable is instead centred around the output of this function.

scaleCovs

A logical scalar denoting whether the fixed effects in the model should be scaled before the analysis: each covariate element is divided by its standard deviation. scaleCovs can also be a function with one argument that is a vector of covariate values. In this case the variable is instead scaled around the output of this function.

Value

A data.frame object containing the scaled and centred values of the covariates. In addition the object is given two attributes:

centreFactor

A named numeric vector of length equal to the number of columns in inData that contains the number used to centre the variable or NA if that variable remains uncentred

scaleFactor

A named numeric vector of length equal to the number of columns in inData that contains the number used to scale the variable or NA if that variable remains unscaled

Author(s)

Joseph D. Chipperfield, joechip90@googlemail.com


joechip90/PaGAn documentation built on April 17, 2025, 4:05 p.m.