Macro's comment is correct, as is Andy's. Here's an example.
> library(rms)
>
> set.seed(1)
> d <- data.frame(x1 = rnorm(50), x2 = rnorm(50))
> d <- within(d, y <- 1 + 2*x1 + 0.3*x2 + 0.2*x2^2 + rnorm(50))
>
> ols1 <- ols(y ~ x1 + pol(x2, 2), data=d) # pol(x2, 2) means include x2 and x2^2 terms
> ols1
Linear Regression Model
ols(formula = y ~ x1 + pol(x2, 2), data = d)
Model Likelihood Discrimination
Ratio Test Indexes
Obs 50 LR chi2 79.86 R2 0.798
sigma 0.9278 d.f. 3 R2 adj 0.784
d.f. 46 Pr(> chi2) 0.0000 g 1.962
Residuals
Min 1Q Median 3Q Max
-1.7463 -0.4789 -0.1221 0.4465 2.2054
Coef S.E. t Pr(>|t|)
Intercept 0.8238 0.1654 4.98 <0.0001
x1 2.0214 0.1633 12.38 <0.0001
x2 0.2915 0.1500 1.94 0.0581
x2^2 0.2242 0.1163 1.93 0.0602
> anova(ols1)
Analysis of Variance Response: y
Factor d.f. Partial SS MS F P
x1 1 131.894215 131.8942148 153.20 <.0001
x2 2 10.900163 5.4500816 6.33 0.0037
Nonlinear 1 3.196552 3.1965524 3.71 0.0602
REGRESSION 3 156.011447 52.0038157 60.41 <.0001
ERROR 46 39.601647 0.8609054
Instead of considering the x2
and x2^2
terms separately, the "chunk test" is the 2-df test which tests the null hypothesis that the coefficients of those terms are both zero (I believe it's more commonly called something like a "general linear F-test"). The p-value for that test is the 0.0037 given by anova(ols1)
.
Note that in the rms
package, you have to specify the x2
terms as pol(x2, 2)
for anova.rms()
to know that they are to be tested together.
anova.rms()
will do similar tests for predictor variables which are represented as restricted cubic splines using, for example, rcs(x2, 3)
, and for categorical predictor variables. It will also include interaction terms in the "chunks".
If you wanted to do a chunk test for general "competing" predictor variables, as mentioned in the quote, I believe you would have to do it manually by fitting the two models separately and then using anova(model1, model2)
. [Edit: this is incorrect - see Frank Harrell's answer.]