Learn R Programming

simsem (version 0.2-0)

residualCovariate: Residual centered all target indicators by covariates

Description

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, in press).

Usage

residualCovariate(data, targetVar, covVar)

Arguments

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

Value

  • The data that the target variables replaced by the residuals

References

  • Geldhof, G. J., Pornprasertmanit, S., Schoemann, A., & Little, T. D. (in press). Orthogonalizing through residual centering: Applications and caveats.Educational and Psychological Measurement.

See Also

  • simFunctionto use this function within a simulation study

Examples

Run this code
dat <- residualCovariate(attitude, 2:7, 1)

Run the code above in your browser using DataLab