Numerous books and lecture slides start to discuss regression analysis as follows:
$$Y=X\beta+\epsilon;\text{ where, } Y\sim N(X\beta, \sigma^2 ) \text{ and } \epsilon\sim N(0, \sigma^2)$$
George Seber wrote in his book (Linear Regression Analysis, Ed 2) at page 42:
$$Var[Y] = Var[Y-X\beta] = Var[\epsilon]$$
I was intended to verify it as follows:
set.seed(123)
n=10000
int=rep(1,n)
x1=rnorm(n,5,3)
x2=rnorm(n, 20, 10)
x3=rnorm(n, -10, 2)
x=cbind(int,x1,x2, x3)
beta=c(10, 2, 0.5, 1.5)
err=rnorm(n, 0, 7)
y=x%*%beta+err
mean(err) # very close to zero
var(err) # very close to 49
mean(y) # very close to 15
var(y) # very close to 118
Somehow I triggered to check whether R square
have a role in equating $Var[Y]$ and $Var[\epsilon]$. Then I checked:
var(y)*(1-(summary(lm(y~x1+x2+x3))$r.squared)) # very close to 49
Yes it is. So $Var[\epsilon] = Var[Y]\times (1-R^2)$. I do not know what I am missing here! Why George Seber and many others never mention it? Certainly, I am wrong, not George Seber. But what is my mistake?
Any lights on my confusion will be appreciated.
Thanks.
set.seed
function which lets everybody to check your result on their computers. $\endgroup$