# [R] producing a graph with glm poisson distributed respons count data and categorical independant variables

babs bas_pauwels at hotmail.com
Fri Jul 27 15:35:27 CEST 2012

```Hello,

I am working on my thesis and can't really figure out how to produce a
reasonable graph from the output from my glm.,
I could just give the R-output in my results and then discuss them, but it
would be more interesting if I could visualise what is going on.
My research is how bees react to different fieldmargins, for this I have 4
different types of field margin (A,B,C & D) and two different experiments,
one where the field margins are adjecent and one where they are seperated.
I wanted to know if the bees react differently on the different types of
field margin and whether there were differences between the two
experiments... I also used an offset function to correct for the different
number of field margins of the same type were the counts have been going on.
I counted the counts of the same fied margins together and then put in the
offset function.

So i used the model that is underneath: mengsel A, B, C & D=type of field
margin and proefopzet 1 and 2= experiment p1 and p2
I already checked if this saturated model is better then that without an
interaction effect:
so I think i have a good model for my data

Call:
glm(formula = count ~ mengsel * proefopzet, family = poisson,
data = a.data, offset = log(opp))

Deviance Residuals:
[1]  0  0  0  0  0  0  0  0

Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept)            5.01507    0.04704 106.622  < 2e-16 ***
mengselB               0.82654    0.05640  14.656  < 2e-16 ***
mengselC              -1.36441    0.12329 -11.067  < 2e-16 ***
mengselD              -2.30702    0.18854 -12.237  < 2e-16 ***
proefopzetp2          -0.92909    0.10303  -9.017  < 2e-16 ***
mengselB:proefopzetp2  0.14373    0.13399   1.073 0.283411
mengselC:proefopzetp2 -2.02842    0.52307  -3.878 0.000105 ***
mengselD:proefopzetp2  3.03323    0.22821  13.291  < 2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for poisson family taken to be 1)

Null deviance:  1.8216e+03  on 7  degrees of freedom
Residual deviance: -1.2212e-14  on 0  degrees of freedom
AIC: 67.589

Number of Fisher Scoring iterations: 3

>
Now...how can i visualise this? I don't seem to find how i could do this...

The data on which this is computed is the following:
> a.data
count proefopzet mengsel opp
1  1033        p1               B            3
2    77           p1               C             2
3   452         p1               A             3
4    30          p1               D             2
5   157         p2               B             1
6     4            p2              C             2
7   119         p2               A             2
8   123         p2               D             1

Thanks,

Babs

--
View this message in context: http://r.789695.n4.nabble.com/producing-a-graph-with-glm-poisson-distributed-respons-count-data-and-categorical-independant-variabs-tp4638110.html
Sent from the R help mailing list archive at Nabble.com.

```

More information about the R-help mailing list