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

2012-07-28 Thread babs
Hi,

I do have replicates, but not many. The offsets are my the number of
replicates actually, i misled myself by thinking i could add the counts of
the replicates all up and then go further with the offset function. I 
decided to split up my experiments in order to interpret them, they were
actually from the beginning split up experiments. Because i thought i could
see if the bees reacted in a same manner to the different experiments i
thought i could analyse it with an interaction factor to reveal whether this
was true. But i want now want to analyse them apart so i can draw
conclusions from the both experiments apart.
I did the following  with the counts from p1, including the replicates so  i
have only the type of field-margin as a variable, as i was only interested
in this from the beginning:
 
mengsel count
C   39
C   38
A   79
A   96
A   278
D   15
D   15
B   322
B   449
B   262

a.data.p1-read.table(a.data.p1.txt,header=TRUE,sep=)
a.data.p1
fit.sat.a.p1-glm(count~mengsel,data=a.data.p1,family=poisson)
anova(fit.sat.a.p1,test=Chisq)
fit.main.a.p1-glm(count~1,data=a.data.p1,family=poisson)
anova(fit.sat.a.p1,fit.main.a.p1,test=Chisq)
extractAIC(fit.sat.a.p1)
extractAIC(fit.main.a.p1)
summary(fit.sat.a.p1)

This tells me that the saturated model is better explaning then the other
so:

Call:
glm(formula = count ~ mengsel, family = poisson, data = a.data.p1)

Deviance Residuals: 
Min   1Q   Median   3Q  Max  
-6.4531  -3.7799  -0.0404   0.0603   9.2385  

Coefficients:
Estimate Std. Error z value Pr(|z|)
(Intercept)  5.017280.04698  106.79   2e-16 ***
mengselB 0.824330.05635   14.63   2e-16 ***
mengselC-1.366620.12327  -11.09   2e-16 ***
mengselD-2.309230.18852  -12.25   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: 1385.58  on 9  degrees of freedom
Residual deviance:  202.01  on 6  degrees of freedom
AIC: 273.15

Number of Fisher Scoring iterations: 5

How can i produce a graph for this?

I am worried that i still do not have enough replicates to actually draw
descent conclusions or conclusions at all...in my second experiment i do not
have replicates  for 2 out of four types of field margins, for the other two
i only have 2 replicates. 

this being the counts from the second experiment:

C   3   p2
C   1   p2
A   90  p2
A   29  p2
D   0   p2
B   157 p2

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-tp4638110p4638192.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


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

2012-07-27 Thread babs
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.015070.04704 106.622   2e-16 ***
mengselB   0.826540.05640  14.656   2e-16 ***
mengselC  -1.364410.12329 -11.067   2e-16 ***
mengselD  -2.307020.18854 -12.237   2e-16 ***
proefopzetp2  -0.929090.10303  -9.017   2e-16 ***
mengselB:proefopzetp2  0.143730.13399   1.073 0.283411
mengselC:proefopzetp2 -2.028420.52307  -3.878 0.000105 ***
mengselD:proefopzetp2  3.033230.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  1033p1   B3
277   p1   C 2
3   452 p1   A 3
430  p1   D 2
5   157 p2   B 1
6 4p2  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.

__
R-help@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.