View source: R/residualCovariate.R
residualCovariate | R Documentation |
This function will regress target variables on the covariate and replace the target variables by the residual of the regression analysis. This procedure is useful to control the covariate from the analysis model (Geldhof, Pornprasertmanit, Schoemann, & Little, 2013).
residualCovariate(data, targetVar, covVar)
data |
The desired data to be transformed. |
targetVar |
Varible names or the position of indicators that users wish to be residual centered (as dependent variables) |
covVar |
Covariate names or the position of the covariates using for residual centering (as independent variables) onto target variables |
The data that the target variables replaced by the residuals
Sunthud Pornprasertmanit (psunthud@gmail.com)
Geldhof, G. J., Pornprasertmanit, S., Schoemann, A. M., & Little, T. D. (2013). Orthogonalizing through residual centering: Extended applications and caveats. Educational and Psychological Measurement, 73(1), 27–46. doi: 10.1177/0013164412445473
indProd
For creating the indicator products with no
centering, mean centering, double-mean centering, or residual centering.
dat <- residualCovariate(attitude, 2:7, 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.