Re: [R] lm on group

2010-01-23 Thread Adaikalavan Ramasamy
You can guess by looking at class(g). It is a factor. It is NOT 
regressing on the mean of g (i.e. 2.5 and 7.5) and you could have 
changed g from (0,5] and (5,10] to A and B with the same results.


Read some books or help(lm) to get an idea of what the outputs mean.

Regards, Adai



newbieR wrote:

Hi all,

  I have a quick question about lm on group, say I have:


x <- 1:10
y <- x*3
buckets <- seq(0, 10, by=5)
g <- cut(x, buckets)
summary(lm(y ~ g - 1))

  Coefficients:
  Estimate Std. Error t value Pr(>|t|)
g(0,5]   9.000  2.121   4.243  0.00283 ** 
g(5,10]   24.000  2.121  11.314 3.35e-06 ***


 What is it doing exactly? I guess the estimate is the mean of the y's
in each group. 


 How about other stats.. what do they exactly mean when we do lm on
groups? 



Thanks a lot!


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] lm on group

2010-01-22 Thread newbieRRRRR

Hi all,

  I have a quick question about lm on group, say I have:

x <- 1:10
y <- x*3
buckets <- seq(0, 10, by=5)
g <- cut(x, buckets)
summary(lm(y ~ g - 1))

  Coefficients:
  Estimate Std. Error t value Pr(>|t|)
g(0,5]   9.000  2.121   4.243  0.00283 ** 
g(5,10]   24.000  2.121  11.314 3.35e-06 ***

 What is it doing exactly? I guess the estimate is the mean of the y's
in each group. 

 How about other stats.. what do they exactly mean when we do lm on
groups? 


Thanks a lot!
-- 
View this message in context: 
http://n4.nabble.com/lm-on-group-tp1107220p1107220.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.