# Partitioned sum of squares

I'm trying to calculate partitioned sum of squares in a linear regression. In the first model, there are two predictors. In the second model, one of these predictors in removed. In the model with two predictors versus the model with one predictor, I have calculated the difference in regression sum of squares to be 2.72 - is this correct? If this is correct, why is the difference in sum of squares 2.72 (quite small) when the difference in r-squared is ~30% (quite large).

# model two predictors
mod <- lm(drat ~ hp + wt, mtcars)

# regression sum of squares two predictors
regressionSumSquares <- sum((predict(mod)-mean(mtcars$drat))*(predict(mod)-mean(mtcars$drat)))

# residuals two predictors
residualSumSquares <- sum((predict(mod)-mtcars$drat)*(predict(mod)-mtcars$drat))

# r-squared two predictors
totalSumSquares <- regressionSumSquares + residualSumSquares
rSquared <- regressionSumSquares/totalSumSquares

# model one predictor
modJustHp <- lm(drat ~ hp, mtcars)

# regression sum of squares one predictor
regressionSumSquaresJustHp <- sum((predict(modJustHp)-mean(mtcars$drat))*(predict(modJustHp)-mean(mtcars$drat)))

# residual sum of squares one predictor
residualSumSquaresJustHp <- sum((predict(modJustHp)-mtcars$drat)*(predict(modJustHp)-mtcars$drat))

# r-squared one predictor
totalSumSquaresJustHp <- regressionSumSquaresJustHp + residualSumSquaresJustHp
rSquaredJustHp <- regressionSumSquaresJustHp/totalSumSquaresJustHp

# difference in sum of squares one vs two predictors
regressionSumSquares - regressionSumSquaresJustHp

• I edited difference in $R^2$ to be 30%, not 30. Presume that is what you meant. – Nick Cox Jun 28 '13 at 12:23

> var(mtcars$drat)*length(mtcars$drat)