Displaying 1 result from an estimated 1 matches for "hat2".
Did you mean:
hat
2007 Mar 15
0
Covariance matrix calc method question
...2,50,20)
LHS<-cbind(x,y)
sample<-nrow(lhs)
# METHOD1
output1<-lm(LHS ~ z)
resids<-resid(output1)
sigma.hat1<-crossprod(resids)/sample
print(sigma.hat1)
print(det(sigma.hat1))
# METHOD2
fit1<-lm(LHS[,1] ~ z)
fit2<-lm(LHS[,2] ~ z)
correctionfactor<-sample-1/sample
sigma.hat2<-correctionfactor*var(cbind(resid(fit1),resid(fit2)))
print(sigma.hat2)
print(det(sigma.hat2))