[R] Interpreting GLM coefficients
Pablo Pita Orduna
ppita at udc.es
Fri Mar 6 23:04:52 CET 2009
Hi all,
I´m fitting GLM´s and I can´t interprete the coefficients when I run a
model with interaction terms.
When I run the simpliest model there is no problem:
Model1<-glm (Fishes ~ Year + I(Year^2) + Kind.Geographic +
Kind.Fishers + Zone.2 + Hours + Fishers + Month, family =
poisson(log)) # Fishes, Year, Hours, and Fishers are numeric,
Kind.Geographic, Kind.Fishers, Zone.2 and Month are factors with 4, 3,
5 and 12 levels respectively.
Model1$coefficients (whith Helmert contrasts):
(Intercept) Year IYear^2 Kind.Geographic1
Kind.Geographic2 Kind.Geographic3 Kind.Fishers1 Kind.Fishers2
Zone.21 Zone.22 Zone.23 Zone.24
-4.416915e+02 4.758455e-01 -1.270986e-04 -5.436199e-01
-1.068809e-01 -1.498580e-01 2.958462e-01 1.316589e-01
-1.328204e-01 -1.605802e-01 5.281869e-03 7.422885e-02
Hours Fishers Month1 Month2
Month3 Month4 Month5 Month6
Month7 Month8 Month9 Month10
9.772076e-02 -2.709955e-03 -1.586887e-01 -1.887837e-02
-5.183241e-03 5.870942e-02 7.075386e-02 2.061223e-02
7.372268e-03 -1.204835e-02 -5.047994e-03 2.441498e-02
Month11
-5.665261e-03
So I can write, for example:
y = -4.416915e+02 + -1.270986e-04*x^2 + 4.758455e-01*x # And add this
function to a plot(Year,Fishes).
My problem is to understand the coefficients for the model with interaction:
Model2<-glm(Fishes ~ Year + I(Year^2) + Kind.Geographic + Kind.Fishers
+ Zone.2 + Hours + Fishers + Month + Year:Kind.Geographic +
Year:Kind.Fishers + Year:Zone.2 + Year:Hours + Year:Fishers +
Year:Month + Kind.Geographic:Hours + Kind.Fishers:Hours + Zone.2:Hours
+ Hours:Fishers + Hours:Month +Kind.Geographic:Fishers +
Zone.2:Fishers + Fishers:Month , poisson (log))
Model2$coefficients (with Helmert contrast):
(Intercept) Year
I(Year^2) Kind.Geographic1 Kind.Geographic2
Kind.Geographic3 Kind.Fishers1 Kind.Fishers2
1.641473e+03 -1.748703e+00
4.664752e-04 -6.721427e+00 1.856033e+01
-3.762727e-02 2.903564e+01 9.022858e+01
Zone.21 Zone.22
Zone.23 Zone.24 Hours
Fishers Month1 Month2
8.110814e-02 -1.902803e+01
8.335792e+00 -3.661641e+00 -7.824623e+00
7.088065e-01 2.479387e+03 8.346729e+02
Month3 Month4
Month5 Month6 Month7
Month8 Month9 Month10
4.052680e+02 2.384440e+02
1.570644e+02 1.032445e+02 7.930499e+01
6.487925e+01 5.592869e+01 3.888328e+01
Month11 Year:Kind.Geographic1
Year:Kind.Geographic2 Year:Kind.Geographic3
Year:Kind.Fishers1 Year:Kind.Fishers2 Year:Zone.21
Year:Zone.22
4.801656e+01 3.397984e-03
-9.443234e-03 NA -1.449305e-02
-4.470212e-02 -6.269309e-05 9.421045e-03
Year:Zone.23 Year:Zone.24
Year:Hours Year:Fishers Year:Month1
Year:Month2 Year:Month3 Year:Month4
-4.184866e-03 1.854810e-03
3.257250e-03 -4.103058e-04 -1.264934e+00
-4.255907e-01 -2.069909e-01 -1.216459e-01
Year:Month5 Year:Month6
Year:Month7 Year:Month8 Year:Month9
Year:Month10 Year:Month11 Kind.Geographic1:Hours
-8.015823e-02 -5.278291e-02
-4.054404e-02 -3.313487e-02 -2.846036e-02
-1.973118e-02 -2.410902e-02 1.341231e-01
Kind.Geographic2:Hours Kind.Geographic3:Hours
Kind.Fishers1:Hours Kind.Fishers2:Hours Zone.21:Hours
Zone.22:Hours Zone.23:Hours
Zone.24:Hours
5.806418e-02 NA
1.318444e-02 -1.234521e-01 7.961319e-04
1.622411e-02 -5.357266e-04 7.749412e-03
Hours:Fishers Hours:Month1
Hours:Month2 Hours:Month3 Hours:Month4
Hours:Month5 Hours:Month6 Hours:Month7
-6.805803e-03 7.971549e+00
2.627090e+00 1.403430e+00 7.747360e-01
5.163810e-01 3.732549e-01 2.827511e-01
Hours:Month8 Hours:Month9
Hours:Month10 Hours:Month11 Kind.Geographic1:Fishers
Kind.Geographic2:Fishers Kind.Geographic3:Fishers
Zone.21:Fishers
2.091230e-01 1.057001e-01
1.159929e-01 NA -3.422994e-02
-3.421851e-03 NA -3.802354e-03
Zone.22:Fishers Zone.23:Fishers
Zone.24:Fishers Fishers:Month1 Fishers:Month2
Fishers:Month3 Fishers:Month4 Fishers:Month5
1.618358e-05 4.197350e-04
-8.773088e-05 7.806815e-01 2.509529e-01
1.280752e-01 7.520139e-02 5.370220e-02
Fishers:Month6 Fishers:Month7
Fishers:Month8 Fishers:Month9 Fishers:Month10
Fishers:Month11
3.786759e-02 2.936135e-02
2.381810e-02 2.422438e-02 NA
NA
I would like to know if it is possible to extract the intercepts and
the slopes for Year and Year^2 for this Model2.
Thank you very much for your help.
________________________________________________________________________________
Pablo Pita Orduna
Grupo de Recursos Marinos y Pesquerías.
Universidade de A Coruña. Campus da Zapateira s/n. E-15071. A Coruña, Spain.
Tel. +34(981) 167000 ext. 2204 Fax. +34(981) 167065.
www.fismare.net/verdeprofundo
----------------------------------------------------------------
Correo enviado usando el servicio de Webmail de la UDC.
More information about the R-help
mailing list