R version 2.9.2 (2009-08-24)
Copyright (C) 2009 The R Foundation for Statistical Computing
ISBN 3-900051-07-0

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

>
>
> supervisor.table <- read.table('http://www-stat.stanford.edu/~jtaylo/courses/stats191/data/supervisor.table', header=T)
> attach(supervisor.table)
>
> # illustration of "partial" regression coefficients
>
> print(lm(Y ~ X1 + X2 + X3 + X4 + X5 + X6)$coef)
(Intercept) X1 X2 X3 X4 X5
10.78707639 0.61318761 -0.07305014 0.32033212 0.08173213 0.03838145
X6
-0.21705668
> W <- resid(lm(X6 ~ X1 + X2 + X3 + X4 + X5))
> Z <- resid(lm(Y ~ X1 + X2 + X3 + X4 + X5))
> print(summary(lm(Z~W))) # coef for W should match row of X6 above,

Call:
lm(formula = Z ~ W)

Residuals:
Min 1Q Median 3Q Max
-10.9418 -4.3555 0.3158 5.5425 11.5990

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 9.369e-17 1.170e+00 8.01e-17 1.000
W -2.171e-01 1.615e-01 -1.344 0.190

Residual standard error: 6.406 on 28 degrees of freedom
Multiple R-squared: 0.06059, Adjusted R-squared: 0.02704
F-statistic: 1.806 on 1 and 28 DF, p-value: 0.1898

> # t-statistic, etc. will not because of
> # df, and error sum of squares is not the same
>
>

>
> proc.time()
user system elapsed
0.580 0.040 0.621
R script