Below is some of the summary data from a mixed model I have run in R (produced by summary()
):
Fixed effects:
Estimate Std. Error df t value Pr(>|t|)
(Intercept) -3.295e-01 1.227e-01 3.740e+01 -2.683 0.0108 *
STANDING.L 8.447e-02 7.091e-02 7.346e+02 1.188 0.2354
STANDING.Q -4.624e-03 5.940e-02 7.323e+02 -0.078 0.9380
STANDING.C 2.899e-03 5.560e-02 7.327e+02 0.052 0.9585
FIRST.CLASS1 2.643e-02 7.017e-02 7.308e+02 0.376 0.7068
CAREER.L 1.300e-01 5.917e-02 7.345e+02 2.189 0.0289 *
CAREER.Q 8.914e-04 7.370e-02 7.295e+02 0.012 0.9904
GENDER1 9.411e-02 5.892e-02 7.296e+02 1.596 0.1109
HS.COURSES.L -3.996e-02 7.819e-02 7.347e+02 -0.510 0.6102
HS.COURSES.Q 4.977e-02 6.674e-02 7.322e+02 0.745 0.4567
HS.COURSES.C 2.087e-02 5.735e-02 7.298e+02 0.364 0.7163
PARENT.LIVE1 5.770e-03 8.434e-02 7.296e+02 0.068 0.9455
CHILD.SETTING.L 1.241e-01 6.027e-02 7.288e+02 2.057 0.0400 *
CHILD.SETTING.Q -4.911e-02 4.879e-02 7.268e+02 -1.006 0.3146
ES.EXTRA.L 2.702e-02 8.202e-02 7.287e+02 0.329 0.7421
ES.EXTRA.Q 1.267e-01 7.761e-02 7.274e+02 1.631 0.1032
ES.EXTRA.C 8.317e-02 7.533e-02 7.287e+02 1.104 0.2701
TEACH.TAUGHT1 2.475e-01 6.316e-02 7.268e+02 3.918 9.79e-05 ***
SOME1ELSE.TAUGHT1 -1.818e-03 6.116e-02 7.277e+02 -0.030 0.9763
Several of my predictor variables are ordinal, as indicated by the Linear (.L
), Quadratic (.Q
), and sometimes Cubic (.C
) terms that are being automatically generated for them. My question is this: How could I re-run this same regression removing, say, the ES.EXTRA.C
term? In other words, I want to suppress one or more of the automatically-generated polynomial contrasts but potentially keep others. I would have thought update()
could do this, but I haven't been able to get it to work.
I can't share my actual data, but this code will create a few outcomes that are sort of similar and include an illustration of smci's answer below as well:
set.seed(151) #Lock in a fixed random structure to these data.
Y.data = sort(round(rnorm(100, 75, 10))) #Some random Y data that are basically the same form as mine.
X.data1 = as.ordered(rep(c(1,2,3,4), each=25)) #Some random X data that are similar in form to mine.
summary(lm(Y.data~X.data1)) #This is what I had been doing, albeit using lmer() instead of lm(). It looks to have been creating the polynomial terms automatically.
summary(lm(Y.data~poly(X.data1, 3))) #Returns an error because X.data1 is not numeric
summary(lm(Y.data~poly(as.numeric(X.data1), 3))) #Now returns a call very similar to the first one, but this time I am in control of which polynomial terms are included.
summary(lm(Y.data~poly(as.numeric(X.data1), 2))) #The cubic term is suppressed now, as desired.
As a follow-up, is there a way using poly()
to get only a certain mixture of polynomial terms? Say, the cubic and fourth power ones only? I have no idea why one would want to do that, but it seems like something worth knowing...