STA302H5 Lecture 12: Lecture 12 - 20131021_004923.pdf
Document Summary
> # mod1 is a list of lists -- see help(lm) > mod1[1:8] # just the first 8 -- there are 200. > # summary object is a linked list too. lm(formula = gpa ~ verbal + math, data = sat) > is. list( summary(mod1)[10] ) # it"s a list with one element. > summary(mod1)[[10]] # 10th element as a numeric vector value numdf dendf. > summary(mod1)[[10]][1] # just the f statistic first element value. > v = vcov(mod1); v # estimated cov(betahat) (intercept) verbal math (intercept) 0. 1948393932 -1. 216189e-04 -1. 861246e-04. > mod1 = lm(gpa ~ verbal+math, x=t, data=sat) # mod1 now has the x matrix. > g = solve(t(x) %*% x) # x-prime-x inverse. > s2 * g (intercept) verbal math (intercept) 0. 1948393932 -1. 216189e-04 -1. 861246e-04. > low1 = betahat1 - se1*tcrit; up1 = betahat1 + se1*tcrit. > # test equal regression coefficients for math and verbal. > sediff = sqrt(t(a) %*% v %*% a )