[R] The interpretation of lm(y~x)?

Bert Gunter gunter.berton at gene.com
Wed Feb 6 20:22:52 CET 2013


Have you read An Introduction to R or other R tutorial? DO you know
about ordered factors and contrasts in linear models?

-- Bert

On Wed, Feb 6, 2013 at 5:00 AM, jing tang <gimmytang at gmail.com> wrote:
> Hi,
> I am reading the book "Mixed Effects Models in S and S-Plus" and come
> across an example with the Rail data.
> I tried to use lm(travel~Rail,data=Rail) and got the following result:
>
> Call:
> lm(formula = travel ~ Rail, data = Rail)
>
> Residuals:
>     Min      1Q  Median      3Q     Max
> -6.6667 -1.0000  0.1667  1.0000  6.3333
>
> Coefficients:
>             Estimate Std. Error t value Pr(>|t|)
> (Intercept)  66.5000     0.9477  70.169  < 2e-16 ***
> Rail.L       54.3032     2.3214  23.392 2.22e-11 ***
> Rail.Q       -4.6917     2.3214  -2.021 0.066161 .
> Rail.C       -2.6584     2.3214  -1.145 0.274458
> Rail^4       -0.5669     2.3214  -0.244 0.811181
> Rail^5       11.1919     2.3214   4.821 0.000418 ***
> ---
> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
>
>
> I wonder how the model is represented. Is it correct to write: Travel =
> beta1 + beta2*Rail + error? Beta1 should be Intercept which is clear to me.
> But how to link beta2 with the coefficients Rail.L, Rail.Q, Rail.C, Rail^4
> and Rail^5 shown in the result?
>
> Thanks for your comments,
>
> Best,
> Jing
>
>         [[alternative HTML version deleted]]
>
>
> ______________________________________________
> R-help at 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.
>



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list