[R] two methods for regression, two different results

From: John Sorkin <jsorkin_at_grecc.umaryland.edu>
Date: Wed 06 Apr 2005 - 12:54:40 EST


Please forgive a straight stats question, and the informal notation.  

let us say we wish to perform a liner regression: y=b0 + b1*x + b2*z  

There are two ways this can be done, the usual way, as a single regression,
fit1<-lm(y~x+z)
or by doing two regressions. In the first regression we could have y as the dependent variable and x as the independent variable fit2<-lm(y~x).
The second regrssion would be a regression in which the residuals from the first regression would be the depdendent variable, and the independent variable would be z.
fit2<-lm(fit2$residuals~z)  

I would think the two methods would give the same p value and the same beta coefficient for z. The don't. Can someone help my understand why the two methods do not give the same results. Additionally, could someone tell me when one method might be better than the other, i.e. what question does the first method anwser, and what question does the second method answer. I have searched a number of textbooks and have not found this question addressed.  

Thanks,
John  

John Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
Baltimore VA Medical Center GRECC and
University of Maryland School of Medicine Claude Pepper OAIC  

University of Maryland School of Medicine Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524  

410-605-7119
- NOTE NEW EMAIL ADDRESS:
jsorkin@grecc.umaryland.edu

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Wed Apr 06 13:02:55 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:02 EST