# [R] Change in R**2 for block entry regression

Chuck Cleland ccleland at optonline.net
Thu Aug 9 11:06:09 CEST 2007

```David Kaplan wrote:
> Hi all,
>
> I'm demonstrating a block entry regression using R for my regression
> class.  For each block, I get the R**2 and the associated F.  I do this
> with separate regressions adding the next block in and then get the
> results by writing separate summary() statements for each regression.
> Is there a more convenient way to do this and also to get the change in
> R**2 and associated F test for the change?
>
>
> David

I'm not sure this is the best approach, but you might start with the
data frame returned by applying anova() to several models and extend
that to include the squared multiple correlation and increments:

mod.0 <- lm(breaks ~ 1, data = warpbreaks)
mod.1 <- lm(breaks ~ 1 + wool, data = warpbreaks)
mod.2 <- lm(breaks ~ 1 + wool + tension, data = warpbreaks)
mod.3 <- lm(breaks ~ 1 + wool * tension, data = warpbreaks)
BlockRegSum <- anova(mod.0, mod.1, mod.2, mod.3)
BlockRegSum\$IncR2 <- c(NA, diff(BlockRegSum\$R2))
BlockRegSum\$R2 <- NA

BlockRegSum

Analysis of Variance Table

Model 1: breaks ~ 1
Model 2: breaks ~ 1 + wool
Model 3: breaks ~ 1 + wool + tension
Model 4: breaks ~ 1 + wool * tension
Res.Df    RSS Df Sum of Sq      F    Pr(>F)        R2     IncR2
1     53 9232.8
2     52 8782.1  1     450.7 3.7653       0.1 0.0488114 0.0488114
3     50 6747.9  2    2034.3 8.4980 0.0006926       0.3       0.2
4     48 5745.1  2    1002.8 4.1891 0.0210442       0.4       0.1

>  BlockRegSum\$R2
         NA 0.04881141 0.26914067 0.37775086

>  BlockRegSum\$IncR2
         NA 0.04881141 0.22032926 0.10861019

>  summary(mod.1)\$r.squared
 0.04881141

>  summary(mod.2)\$r.squared
 0.2691407

>  summary(mod.3)\$r.squared
 0.3777509

--
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894

```