center.numeric: Center Numeric Variable About Its Mean

View source: R/center.numeric.R

center.numericR Documentation

Center Numeric Variable About Its Mean

Description

Centers a numeric variable about its mean. That is, the mean of the variable becomes the new 0, values greater than the mean are positive, and values smaller than the mean are negative.

Usage

center.numeric(x, na.rm = FALSE)

Arguments

x

numeric vector that should be centered about its mean.

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

Details

In many cases, mean-centering predictor variables in a regression model often results in a more interpretable intercept. The intercept captures the predicted y value when all other variables are 0; however, predicting (for instance) reading time when word length is 0 characters long is not very informative because no word can be zero characters long. Mean-centering the word length predictor would result in the intercept corresponding to predicted reading time at an average word length, which is more meaningful.

In addition, mean-centering can often facilitate convergence of mixed-effect regression models.

However, the choice of whether to center a variable should ultimately be guided by the particular substantive question at hand.

Value

numeric vector centered about its mean.

References

Barr, D.J., Levy, R., Scheepers, C., & Tily, H.J. (2013). Random effects structure for confirmatory hypothesis testing: Keep it maximal. Journal of Memory and Language, 68, 255-278.

See Also

contr.helmert.weighted for centering factor (categorical) variables.

Examples

wordLengths <- c(4, 7, 10)
wordLengths.c <- center.numeric(wordLengths)

sfraundorf/psycholing documentation built on April 23, 2022, 2:50 a.m.