Dear Thierry,


Thanks for your answer and for letting me know about the R-Sig-mixed models mailing list! 

"Furthermore you assume that the first visit in year 1 has the same effect as the first visit in year 2 and 3. And the same goes for the other visits. Is that a valid assumption for your data?" 

Hmm, these are rather sparse data from small birds in Ecuadorian forests so it will be best to use a model syntax that makes the least assumptions possible. As suggested, I renamed 'counts' to "visits' and numbered them from 1 to 15. If I understand the nlme syntax, I need something like this:


nlme(abundance~X1+X2+visit,
	fixed=X1+X2~1,
	random=visit~1 | site/point)


However, this seems to results in the following error:

Error in nlme.formula(abundance ~ X1 + X2 + visit, fixed = X1 + X2 ~ 1,  : 
  element 1 is empty;
   the part of the args list of 'is.numeric' being evaluated was:
   (start)

Moreover, nlme seens to use either "REML" or "ML" and I have not found any hints on how to specify a zero-inflated Poisson distribution for nmle... Any suggestions?

Many thanks and best wishes!

Diederik



Diederik Strubbe
Evolutionary Ecology Group
Department of Biology, University of Antwerp
Universiteitsplein 1
B-2610 Antwerp, Belgium
http://webhost.ua.ac.be/deco
tel : 32 3 820 23 85



-----Original Message-----
From: ONKELINX, Thierry [mailto:Thierry.ONKELINX@inbo.be]
Sent: Tue 14-4-2009 15:46
To: Strubbe Diederik; r-help@r-project.org
Subject: RE: [R] Question on zero-inflated Poisson count data with repeatedmeasures design - glmm.ADMB
 
Dear Diederik,

If you revisited the same points then it makes sense to use the data at
the point level. But then I would mke that explicit by using a nested
random effect. In the nlme/lme4 syntax: 1|Site/Point. Make shure that
each point has a unique ID.

Naming a variable "count" is not a very good idea unless it is something
you counted. I would suggest to rename it to "visit". That would cause
less confugion. It looks to me like you have in your model a crossed
random effect: Visit and Site. Was that intended? Furthermore you assume
that the first visit in year 1 has the same effect as the first visit in
year 2 and 3. And the same goes for the other visits. Is that a valid
assumption for your data? 

Including year as a random effect is not a good idea since is has only
three levels. Douglas Bates recommends at least six levels for a random
effect. Otherwise you don't get a good estimate of its variance. You
could number the visits from 1 to 15 instead of restarting from 1 each
year. Then you make less assumitions about your model. As this random
effect would incorporate the effects of year, visit and their
interaction.

HTH,

Thierry

PS R-Sig-mixed models is a mailing list dedicated to mixed models. That
is more appropriate for this kind of questions.


------------------------------------------------------------------------
----
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature
and Forest
Cel biometrie, methodologie en kwaliteitszorg / Section biometrics,
methodology and quality assurance
Gaverstraat 4
9500 Geraardsbergen
Belgium 
tel. + 32 54/436 185
Thierry.Onkelinx@inbo.be 
www.inbo.be 

To call in the statistician after the experiment is done may be no more
than asking him to perform a post-mortem examination: he may be able to
say what the experiment died of.
~ Sir Ronald Aylmer Fisher

The plural of anecdote is not data.
~ Roger Brinner

The combination of some data and an aching desire for an answer does not
ensure that a reasonable answer can be extracted from a given body of
data.
~ John Tukey

-----Oorspronkelijk bericht-----
Van: r-help-bounces@r-project.org [mailto:r-help-bounces@r-project.org]
Namens Strubbe Diederik
Verzonden: maandag 13 april 2009 22:35
Aan: r-help@r-project.org
Onderwerp: [R] Question on zero-inflated Poisson count data with
repeatedmeasures design - glmm.ADMB

Dear R community,

I have some questions regarding the analysis of a zero-inflated count
dataset and repeated measures design.

The dataset is arranged as follows :
Unit of analysis: point - these are points were bird were counted during
a certain amount of time. In total we have about 175 points. Each point
is located within a certain habitat fragment (here: "site"= A-B-C-D-...,
in reality we have 25 sites,i.e. forest fragments). All points were
counted five times during three years ( thus in total, each point was
counted 15 times). We want to relate the bird abundance to a number of
habitat variables (here: X1-X2-X3) collected at the site level.
Abundance: this is the number of birds counted at a point. In most cases
( > 90%), no birds were detected and the abundance dataset is thus
zero-inflated.

I have been looking for a code to analyze this zero-inflated poisson
distributed dataset with a repeated measures design, and I have arrived
at the glmmADMB package.

library(glmmADMB)
data <- read.table("D:/Boris/Borisdataset.csv",sep=",",header=TRUE)
count <- data$count
site <- data$site
abundance <- data$abundance
test<-glmm.admb(abundance~data$X1+data$X2+data$year,random=~count,group=
"site",data=data,family="poisson",zeroInflation=TRUE)

[ for clarity: in the above syntax: count ranges from 1-5 as each site
has been counted 5 times in a year, site refers to one of the 25 forest
fragments in which the point counts were conducted, Xi are the habitat
variables].

My questions are:
- does it make sense to analyze these data at the point level, as all
habitat variables are collected at the site level, meaning that for all
points belonging to a certain forest fragment, the habitat variables
have the same value. If it does make sense, is the proposed syntax ok?
Is there any option to include year as a random effect, as I am not
especially interested in differences between years.
-it looks appealing to average the point count values for each forest
fragment, and to analyze the data with "forest fragment" as unit of
analysis. However, also when averaging across fragments, the dataset is
still zero-inflated. It is however impossible to a zero-inflated Poisson
distribution for this analysis, as the averaged forest fragment values
are not always discrete values.

Many thanks in advance,

Diederik

{example of dataset reproduced below....}
X1	X2	X3	point	site	count 	year	abundance
1.23598	0.277765	0.861794	1	A	1	2001
0
1.23598	0.277765	0.861794	1	A	2	2001
0
1.23598	0.277765	0.861794	1	A	3	2001
6
1.23598	0.277765	0.861794	1	A	4	2001
10
1.23598	0.277765	0.861794	1	A	5	2001
0
1.23598	0.277765	0.861794	2	A	1	2001
0
1.23598	0.277765	0.861794	2	A	2	2001
0
1.23598	0.277765	0.861794	2	A	3	2001
0
1.23598	0.277765	0.861794	2	A	4	2001
0
1.23598	0.277765	0.861794	2	A	5	2001
0
1.23598	0.277765	0.861794	3	A	1	2001
9
1.23598	0.277765	0.861794	3	A	2	2001
3
1.23598	0.277765	0.861794	3	A	3	2001
5
1.23598	0.277765	0.861794	3	A	4	2001
0
1.23598	0.277765	0.861794	3	A	5	2001
0
1.23598	0.277765	0.861794	1	A	1	2002
9
1.23598	0.277765	0.861794	1	A	2	2002
0
1.23598	0.277765	0.861794	1	A	3	2002
0
1.23598	0.277765	0.861794	1	A	4	2002
0
1.23598	0.277765	0.861794	1	A	5	2002
0
1.23598	0.277765	0.861794	2	A	1	2002
0
1.23598	0.277765	0.861794	2	A	2	2002
0
1.23598	0.277765	0.861794	2	A	3	2002
0
1.23598	0.277765	0.861794	2	A	4	2002
0
1.23598	0.277765	0.861794	2	A	5	2002
0
1.23598	0.277765	0.861794	3	A	1	2002
0
1.23598	0.277765	0.861794	3	A	2	2002
0
1.23598	0.277765	0.861794	3	A	3	2002
0
1.23598	0.277765	0.861794	3	A	4	2002
0
1.23598	0.277765	0.861794	3	A	5	2002
0
1.23598	0.277765	0.861794	1	A	1	2003
5
1.23598	0.277765	0.861794	1	A	2	2003
5
1.23598	0.277765	0.861794	1	A	3	2003
0
1.23598	0.277765	0.861794	1	A	4	2003
0
1.23598	0.277765	0.861794	1	A	5	2003
0
1.23598	0.277765	0.861794	2	A	1	2003
0
1.23598	0.277765	0.861794	2	A	2	2003
0
1.23598	0.277765	0.861794	2	A	3	2003
0
1.23598	0.277765	0.861794	2	A	4	2003
6
1.23598	0.277765	0.861794	2	A	5	2003
4
1.23598	0.277765	0.861794	3	A	1	2003
0
1.23598	0.277765	0.861794	3	A	2	2003
0
1.23598	0.277765	0.861794	3	A	3	2003
9
1.23598	0.277765	0.861794	3	A	4	2003
0
1.23598	0.277765	0.861794	3	A	5	2003
0
0.47955	0.403671	0.980391	1	B	1	2001
0
0.47955	0.403671	0.980391	1	B	2	2001
0
0.47955	0.403671	0.980391	1	B	3	2001
0
0.47955	0.403671	0.980391	1	B	4	2001
0
0.47955	0.403671	0.980391	1	B	5	2001
9
0.47955	0.403671	0.980391	2	B	1	2001
1
0.47955	0.403671	0.980391	2	B	2	2001
9
0.47955	0.403671	0.980391	2	B	3	2001
0
0.47955	0.403671	0.980391	2	B	4	2001
0
0.47955	0.403671	0.980391	2	B	5	2001
0
0.47955	0.403671	0.980391	3	B	1	2001
0
0.47955	0.403671	0.980391	3	B	2	2001
0
0.47955	0.403671	0.980391	3	B	3	2001
0
0.47955	0.403671	0.980391	3	B	4	2001
7
0.47955	0.403671	0.980391	3	B	5	2001
0
0.47955	0.403671	0.980391	1	B	1	2002
0
0.47955	0.403671	0.980391	1	B	2	2002
0
0.47955	0.403671	0.980391	1	B	3	2002
0
0.47955	0.403671	0.980391	1	B	4	2002
1
0.47955	0.403671	0.980391	1	B	5	2002
0
0.47955	0.403671	0.980391	2	B	1	2002
0
0.47955	0.403671	0.980391	2	B	2	2002
0
0.47955	0.403671	0.980391	2	B	3	2002
0
0.47955	0.403671	0.980391	2	B	4	2002
6
0.47955	0.403671	0.980391	2	B	5	2002
0
0.47955	0.403671	0.980391	3	B	1	2002
0
0.47955	0.403671	0.980391	3	B	2	2002
5
0.47955	0.403671	0.980391	3	B	3	2002
0
0.47955	0.403671	0.980391	3	B	4	2002
2
0.47955	0.403671	0.980391	3	B	5	2002
0
0.47955	0.403671	0.980391	1	B	1	2003
0
0.47955	0.403671	0.980391	1	B	2	2003
0
0.47955	0.403671	0.980391	1	B	3	2003
0
0.47955	0.403671	0.980391	1	B	4	2003
0
0.47955	0.403671	0.980391	1	B	5	2003
0
0.47955	0.403671	0.980391	2	B	1	2003
0
0.47955	0.403671	0.980391	2	B	2	2003
0
0.47955	0.403671	0.980391	2	B	3	2003
0
0.47955	0.403671	0.980391	2	B	4	2003
0
0.47955	0.403671	0.980391	2	B	5	2003
0
0.47955	0.403671	0.980391	3	B	1	2003
0
0.47955	0.403671	0.980391	3	B	2	2003
0
0.47955	0.403671	0.980391	3	B	3	2003
0
0.47955	0.403671	0.980391	3	B	4	2003
0
0.47955	0.403671	0.980391	3	B	5	2003
0
0.036829	0.49832	0.906583	1	C	1	2001
0
0.036829	0.49832	0.906583	1	C	2	2001
0
0.036829	0.49832	0.906583	1	C	3	2001
0
0.036829	0.49832	0.906583	1	C	4	2001
9
0.036829	0.49832	0.906583	1	C	5	2001
0
0.036829	0.49832	0.906583	2	C	1	2001
0
0.036829	0.49832	0.906583	2	C	2	2001
0
0.036829	0.49832	0.906583	2	C	3	2001
0
0.036829	0.49832	0.906583	2	C	4	2001
0
0.036829	0.49832	0.906583	2	C	5	2001
6
0.036829	0.49832	0.906583	3	C	1	2001
0
0.036829	0.49832	0.906583	3	C	2	2001
0
0.036829	0.49832	0.906583	3	C	3	2001
0
0.036829	0.49832	0.906583	3	C	4	2001
0
0.036829	0.49832	0.906583	3	C	5	2001
8
0.036829	0.49832	0.906583	1	C	1	2002
0
0.036829	0.49832	0.906583	1	C	2	2002
0
0.036829	0.49832	0.906583	1	C	3	2002
7
0.036829	0.49832	0.906583	1	C	4	2002
0
0.036829	0.49832	0.906583	1	C	5	2002
0
0.036829	0.49832	0.906583	2	C	1	2002
0
0.036829	0.49832	0.906583	2	C	2	2002
3
0.036829	0.49832	0.906583	2	C	3	2002
0
0.036829	0.49832	0.906583	2	C	4	2002
0
0.036829	0.49832	0.906583	2	C	5	2002
0
0.036829	0.49832	0.906583	3	C	1	2002
0
0.036829	0.49832	0.906583	3	C	2	2002
0
0.036829	0.49832	0.906583	3	C	3	2002
0
0.036829	0.49832	0.906583	3	C	4	2002
0
0.036829	0.49832	0.906583	3	C	5	2002
0
0.036829	0.49832	0.906583	1	C	1	2003
0
0.036829	0.49832	0.906583	1	C	2	2003
0
0.036829	0.49832	0.906583	1	C	3	2003
6
0.036829	0.49832	0.906583	1	C	4	2003
0
0.036829	0.49832	0.906583	1	C	5	2003
0
0.036829	0.49832	0.906583	2	C	1	2003
7
0.036829	0.49832	0.906583	2	C	2	2003
0
0.036829	0.49832	0.906583	2	C	3	2003
2
0.036829	0.49832	0.906583	2	C	4	2003
9
0.036829	0.49832	0.906583	2	C	5	2003
0
0.036829	0.49832	0.906583	3	C	1	2003
0
0.036829	0.49832	0.906583	3	C	2	2003
0
0.036829	0.49832	0.906583	3	C	3	2003
0
0.036829	0.49832	0.906583	3	C	4	2003
0
0.036829	0.49832	0.906583	3	C	5	2003
0
1.23598	0.129	1.30048	1	D	1	2001	0
1.23598	0.129	1.30048	1	D	2	2001	0
1.23598	0.129	1.30048	1	D	3	2001	6
1.23598	0.129	1.30048	1	D	4	2001	10
1.23598	0.129	1.30048	1	D	5	2001	0
1.23598	0.129	1.30048	2	D	1	2001	0
1.23598	0.129	1.30048	2	D	2	2001	0
1.23598	0.129	1.30048	2	D	3	2001	0
1.23598	0.129	1.30048	2	D	4	2001	12
1.23598	0.129	1.30048	2	D	5	2001	0
1.23598	0.129	1.30048	3	D	1	2001	9
1.23598	0.129	1.30048	3	D	2	2001	3
1.23598	0.129	1.30048	3	D	3	2001	5
1.23598	0.129	1.30048	3	D	4	2001	1
1.23598	0.129	1.30048	3	D	5	2001	0
1.23598	0.129	1.30048	1	D	1	2002	9
1.23598	0.129	1.30048	1	D	2	2002	2
1.23598	0.129	1.30048	1	D	3	2002	0
1.23598	0.129	1.30048	1	D	4	2002	3
1.23598	0.129	1.30048	1	D	5	2002	0
1.23598	0.129	1.30048	2	D	1	2002	0
1.23598	0.129	1.30048	2	D	2	2002	0
1.23598	0.129	1.30048	2	D	3	2002	0
1.23598	0.129	1.30048	2	D	4	2002	0
1.23598	0.129	1.30048	2	D	5	2002	0
1.23598	0.129	1.30048	3	D	1	2002	0
1.23598	0.129	1.30048	3	D	2	2002	0
1.23598	0.129	1.30048	3	D	3	2002	0
1.23598	0.129	1.30048	3	D	4	2002	0
1.23598	0.129	1.30048	3	D	5	2002	0
1.23598	0.129	1.30048	1	D	1	2003	5
1.23598	0.129	1.30048	1	D	2	2003	5
1.23598	0.129	1.30048	1	D	3	2003	0
1.23598	0.129	1.30048	1	D	4	2003	0
1.23598	0.129	1.30048	1	D	5	2003	0
1.23598	0.129	1.30048	2	D	1	2003	0
1.23598	0.129	1.30048	2	D	2	2003	0
1.23598	0.129	1.30048	2	D	3	2003	0
1.23598	0.129	1.30048	2	D	4	2003	6
1.23598	0.129	1.30048	2	D	5	2003	4
1.23598	0.129	1.30048	3	D	1	2003	0
0.418671	0.087187	0.504914	1	E	1
2001	0
0.418671	0.087187	0.504914	1	E	2
2001	0
0.418671	0.087187	0.504914	1	E	3
2001	6
0.418671	0.087187	0.504914	1	E	4
2001	10
0.418671	0.087187	0.504914	1	E	5
2001	0
0.418671	0.087187	0.504914	2	E	1
2001	0
0.418671	0.087187	0.504914	2	E	2
2001	0
0.418671	0.087187	0.504914	2	E	3
2001	0
0.418671	0.087187	0.504914	2	E	4
2001	0
0.418671	0.087187	0.504914	2	E	5
2001	0
0.418671	0.087187	0.504914	3	E	1
2001	9
0.418671	0.087187	0.504914	3	E	2
2001	3
0.418671	0.087187	0.504914	3	E	3
2001	5
0.418671	0.087187	0.504914	3	E	4
2001	0
0.418671	0.087187	0.504914	3	E	5
2001	0
0.418671	0.087187	0.504914	1	E	1
2002	9
0.418671	0.087187	0.504914	1	E	2
2002	0
0.418671	0.087187	0.504914	1	E	3
2002	0
0.418671	0.087187	0.504914	1	E	4
2002	0
0.418671	0.087187	0.504914	1	E	5
2002	0
0.418671	0.087187	0.504914	2	E	1
2002	0
0.418671	0.087187	0.504914	2	E	2
2002	0
0.418671	0.087187	0.504914	2	E	3
2002	0
0.418671	0.087187	0.504914	2	E	4
2002	0
0.418671	0.087187	0.504914	2	E	5
2002	0
0.418671	0.087187	0.504914	3	E	1
2002	0
0.418671	0.087187	0.504914	3	E	2
2002	0
0.418671	0.087187	0.504914	3	E	3
2002	0
0.418671	0.087187	0.504914	3	E	4
2002	0
0.418671	0.087187	0.504914	3	E	5
2002	0
0.418671	0.087187	0.504914	1	E	1
2003	5
0.418671	0.087187	0.504914	1	E	2
2003	5
0.418671	0.087187	0.504914	1	E	3
2003	0
0.418671	0.087187	0.504914	1	E	4
2003	0
0.418671	0.087187	0.504914	1	E	5
2003	0
0.418671	0.087187	0.504914	2	E	1
2003	0
0.418671	0.087187	0.504914	2	E	2
2003	0
0.418671	0.087187	0.504914	2	E	3
2003	0
0.418671	0.087187	0.504914	2	E	4
2003	6
0.418671	0.087187	0.504914	2	E	5
2003	4
0.418671	0.087187	0.504914	3	E	1
2003	0
0.418671	0.087187	0.504914	3	E	2
2003	0
0.418671	0.087187	0.504914	3	E	3
2003	9
0.418671	0.087187	0.504914	3	E	4
2003	0
0.418671	0.087187	0.504914	3	E	5
2003	0






Diederik Strubbe
Evolutionary Ecology Group
Department of Biology, University of Antwerp
Universiteitsplein 1
B-2610 Antwerp, Belgium
http://webhost.ua.ac.be/deco
tel : 32 3 820 23 85


	[[alternative HTML version deleted]]

______________________________________________
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.

Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer 
en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is
door een geldig ondertekend document. The views expressed in  this message
and any annex are purely those of the writer and may not be regarded as stating 
an official position of INBO, as long as the message is not confirmed by a duly 
signed document.


	[[alternative HTML version deleted]]


