Calculates a "residual-centered" interaction regression.
Calculates a "residual-centered" interaction regression.
Given a fitted lm, this function scans for coefficients estimated from "interaction terms" by checking for colon symbols. The function then calculates the "residual centered" estimate of the interaction term and replaces the interaction term with that residual centered estimate. It works for any order of interaction, unlike other implementations of the same approach. The function lmres in the now-archived package pequod was a similar function.
Calculates predicted values of residual centered interaction regressions estimated in any type of regression framework (lm, glm, etc).
residualCenter(model)## Default S3 method:residualCenter(model)## S3 method for class 'rcreg'predict(object,...)
Arguments
model: A fitted lm object
object: Fitted residual-centered regression from residualCenter
...: Other named arguments. May include newdata, a dataframe of predictors. That should include values for individual predictor, need not include interactions that are constructed by residualCenter. These parameters that will be passed to the predict method of the model.
Returns
a regression model of the type as the input model, with the exception that the residualCentered predictor is used in place of the original interaction. The return model includes new variable centeringRegressions: a list including each of the intermediate regressions that was calculated in order to create the residual centered interaction terms. These latter objects may be necessary for diagnostics and to calculate predicted values for hypothetical values of the inputs. If there are no interactive terms, then NULL is returned.
Little, T. D., Bovaird, J. A., & Widaman, K. F. (2006). On the Merits of Orthogonalizing Powered and Product Terms: Implications for Modeling Interactions Among Latent Variables. Structural Equation Modeling, 13(4), 497-519.