Christoffer Karlsson
2010-Mar-23 09:27 UTC
[R] Log linear model - Showing non-deviation form in glm()
Hey, Whenever I set up a log linear model using glm(Y~. , data=data, family=poisson) I get the parameters in the form of deviation from the first cell kombination. I find this to be hard to interpret when I for instance want to know if there is a difference between two factors in the first category since those parameters are not shown directly. Is there any way to get the summary() command, or equivalent, to show me all of the parameters in the model in non-deviation form? I can use loglin() to get the parameters, but it doesnt show significance of the parameters from what I can tell. Alternatively, can anyone give a brief explanation of how to interpret the model in deviation form? For example here I have the factors "Gamla" and "Nya" and the categories "0", "1-10", "11-50", "51-100" and "101+" The interpretation of the shown interaction terms are no problem, but how do I figure if there is a difference between Gamla and Nya when it comes to category "0"? (Intercept) 7.74760 0.02078 372.852 < 2e-16 *** typNya -2.34943 0.07040 -33.371 < 2e-16 *** kategori1-10 -1.88966 0.05735 -32.950 < 2e-16 *** kategori101+ -4.05872 0.15947 -25.451 < 2e-16 *** kategori11-50 -2.63561 0.08035 -32.802 < 2e-16 *** kategori51-100 -4.61210 0.20955 -22.010 < 2e-16 *** typNya:kategori1-10 0.72561 0.14935 4.858 1.18e-06 *** typNya:kategori101+ -1.33945 1.01486 -1.320 0.187 typNya:kategori11-50 0.18189 0.25221 0.721 0.471 typNya:kategori51-100 -0.09291 0.74056 -0.125 0.900 Thanks for any help, and sorry for the supposedly basic question! Chris [[alternative HTML version deleted]]
Christoffer Karlsson
2010-Mar-23 23:53 UTC
[R] Log linear model - Showing non-deviation form in glm()
I just found the assoc plot function in vcd which lets me visualize the data and shows which effects are significant. I'm not sure if I'm misinterpreting the coefficients from R. The way I interpreted is that since, for example, the interaction term typNya:kategori1-10 is significant and positive, this would mean that theres a larger probability of someone belonging to the factor Nya to end up in "1-10" than someone from Gamla. However, when I change the order of the factors I get the same coefficients but for different factors. So for example if I switch place of "0" and "1-10" it will now instead show "0" as significant with the same coeff as for "1-10" in the original order. The assoc plot still showed only "1-10" to be significant though. Getting confused, so any help would be very much appreciated ;) Chris On Tue, Mar 23, 2010 at 10:27 AM, Christoffer Karlsson <cmanbigbro@gmail.com> wrote:> Hey, > > Whenever I set up a log linear model using glm(Y~. , data=data, > family=poisson) I get the parameters in the form of deviation from the first > cell kombination. > > I find this to be hard to interpret when I for instance want to know if > there is a difference between two factors in the first category since those > parameters are not shown directly. > Is there any way to get the summary() command, or equivalent, to show me > all of the parameters in the model in non-deviation form? > > I can use loglin() to get the parameters, but it doesnt show significance > of the parameters from what I can tell. > > Alternatively, can anyone give a brief explanation of how to interpret the > model in deviation form? For example here I have the factors "Gamla" and > "Nya" and the categories "0", "1-10", "11-50", "51-100" and "101+" > The interpretation of the shown interaction terms are no problem, but how > do I figure if there is a difference between Gamla and Nya when it comes to > category "0"? > > (Intercept) 7.74760 0.02078 372.852 < 2e-16 *** > typNya -2.34943 0.07040 -33.371 < 2e-16 *** > kategori1-10 -1.88966 0.05735 -32.950 < 2e-16 *** > kategori101+ -4.05872 0.15947 -25.451 < 2e-16 *** > kategori11-50 -2.63561 0.08035 -32.802 < 2e-16 *** > kategori51-100 -4.61210 0.20955 -22.010 < 2e-16 *** > typNya:kategori1-10 0.72561 0.14935 4.858 1.18e-06 *** > typNya:kategori101+ -1.33945 1.01486 -1.320 0.187 > typNya:kategori11-50 0.18189 0.25221 0.721 0.471 > typNya:kategori51-100 -0.09291 0.74056 -0.125 0.900 > > > Thanks for any help, and sorry for the supposedly basic question! > Chris >[[alternative HTML version deleted]]