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?

 

Many thanks.

 
	[[alternative HTML version deleted]]

