Re: [R] how to get correct coefficients from lm model

From: Martin Henry H. Stevens <HStevens_at_muohio.edu>
Date: Fri 19 May 2006 - 00:51:07 EST

On May 18, 2006, at 10:37 AM, Kum-Hoe Hwang wrote:

> Howdy
>
> I apologize for duplicated posting. But I decided to correct my
> previous
> posting.
>
> I had the regression results using
>
> r <- lm(Y ~ nemp + as.factor(devt), data=d).
>
Can you tell us how many levels of devt there are? Do
levels(d$devt)

> First, there is the result of anova(r). Here I could not find
> regression
> coefficients.
>
> Response: Y
> Df Sum Sq Mean Sq F value Pr(>F)
> nemp 1 58.2 58.2 1233.23 < 2e-16 ***
> as.factor(devt) 3 3.6 1.2 25.69 2.6e-16 ***
>
> Second, there is the result of summary(r) that I am confused
> with too many coefficients for a factor variable "devt".
> Because there are three coefficients for factor variables
> such as"as.factor(devt)A ", "as.factor(devt)B", "as.factor(devt)C".
>
> Coefficients:
> Estimate Std. Error t value Pr(>|t|)
> (Intercept) as.factor(devt1) 3
> 3.6 1.2
> 25.69 2.6e-16 *** 5.95e-02 10.19 < 2e-16 ***
Why is the as.factor(devt1) here? what is devt1?
> nemp 2.87e-06 1.04e-07 27.63 <
> 2e-16 ***
> as.factor(devt)A 2.44e-02 1.47e-02 1.66 0.09630 .
> as.factor(devt)B -1.10e-01 1.40e-02 -7.90 4.6e-15 ***
> as.factor(devt)C -9.19e-03 1.53e-02 -0.60 0.54953
>
> Is this model right as a tentative model at least?
> Y = 6.07e-01 + 2.87e-06* nemp + 2.44e-02 * as.factor(devt)A
> - 1.10e-01 * as.factor(devt1)B - 9.19e-03 * as.factor(devt)C
>
>
> And so, my question is "which coefficients should I use for a final
> model?".
>
> Thanks in advance,
> --
> Kum-Hoe Hwang, Ph.D.Phone : 82-31-250-3516Email : phdhwang@gmail.com
>
> [[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

Dr. M. Hank H. Stevens, Assistant Professor 338 Pearson Hall
Botany Department
Miami University
Oxford, OH 45056

Office: (513) 529-4206
Lab: (513) 529-4262
FAX: (513) 529-4243

http://www.cas.muohio.edu/~stevenmh/
http://www.muohio.edu/ecology/
http://www.muohio.edu/botany/

"E Pluribus Unum"

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 Fri May 19 00:58:15 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 19 May 2006 - 02:10:10 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.