question about 1-way anova
On May 11, 2013, at 06:10 , meng wrote:
Hi all: I have a question about one-way anova. The data is ??sleep??which belongs to R. code1: summary(lm(extra~group)) Estimate of group2(1.58) is the difference between mean of group1 and group2,and t value(1.861) and p value(0.0792) is the same as 2 sample t test,and the code is ?? t.test(extra~group)??. My question: The p value of Intercept(0.2276) tests for what? My guess is test the difference between mean of group1 vs 0: dat1<-extra[group==1] t.test(dat1,mu=0) But the p value is 0.2176,which is different from 0.2276 of lm result. code2: summary(lm(extra~group+0)) The pvalue of group1(0.2276) and group2(0.0011). My question: The p value of group1 and group2 tests for what? My guess is test the difference between mean of group1 vs 0 and group2 vs 0: dat1<-extra[group==1] t.test(dat1,mu=0) The p value is 0.2176,which is different from 0.2276 of lm result. dat2<-extra[group==2] t.test(dat2,mu=0) The p value is 0.005076, which is different from 0.0011 of lm result. So,what??s wrong with my guess?
You need to pay more attention to the degrees of freedom for error.
Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd.mes at cbs.dk Priv: PDalgd at gmail.com