Skip to content

glmmADMB

7 messages · Ben Bolker, rbuxton, Paul Johnson

#
Hi there,

I am new to the package glmmadmb, but need it to perform a zero-inflated
gzlmm with a binomial error structure.  I can't seem to get it to work
without getting some strange error messages.

I am trying to find out what is affecting the number of seabird calls on an
array of recorders placed at 4 sites on 6 islands.  I have nightly variables
(weather and moonlight), site variables (proximity to a source population of
seabirds and proximity to a refugia from predators). and island variables
(island size and number of years since predator eradication).  

Here's a sample of my data:

Date	ISLAND	SITE	Calls	Years Erad	Island size	Refugia	Dist Source	Moon	Wind
Speed
5/28/2009	Amatignak 	East	9	19	3543	3	58.6	0.2	2.54
5/29/2009	Amatignak 	East	120	19	3543	3	58.6	0.3	4.63
5/30/2009	Amatignak 	East	18	19	3543	3	58.6	0.4	13.09
6/4/2009	Amatignak 	North	23	19	3543	2	54.2	0.9	4.14
6/5/2009	Amatignak 	North	69	19	3543	2	54.2	1	2.06
6/6/2009	Amatignak 	North	62	19	3543	2	54.2	1	3.94
6/7/2009	Buldir	N Bight	357	100	2000	4	0	1	7.49
6/8/2009	Buldir	N Bight	567	100	2000	4	0	1	4.17
6/9/2009	Buldir	N Bight	150	100	2000	4	0	1	4.13

My model is as follows:

number of seabird calls ~ weather+moonlight+distance to source
population+island size+years since predator eradication+nearby refugia from
predators+ (1|Site/Island)

first I removed na's from my data

callsna <- na.omit(calls)

Then I started simple, with only "moonlight" and "weather" included in a
model (just as a test):

mod <- glmmadmb(Calls~ Moon+Wind.Speed+(1|SITE/ISLAND), data=callsna,
zeroInflation=TRUE, family="nbinom")

I get the following error message:
Error in II[, ii] = II[, ii] + REmat$codes[[i]] : 
  replacement has length zero
In addition: Warning message:
In matrix(rep(q, m), nrow = n, ncol = sum(m), byrow = TRUE) :
  data length exceeds size of matrix

I get the same error message when I try with the full model or a null model!

I don't understand what this means.  The model works ok in lmer4 with a
poisson distribution (althought it's very overdispersed), so it's not as
though it wont work at all.

Any help with this would be greatly appreciated

cheers
Rachel


--
View this message in context: http://r.789695.n4.nabble.com/glmmADMB-tp4616701.html
Sent from the R help mailing list archive at Nabble.com.
#
rbuxton <moyble <at> hotmail.com> writes:
# I am trying to find out what is affecting the number of seabird
# calls on an array of recorders placed at 4 sites on 6 islands.  I
# have nightly variables (weather and moonlight), site variables
# (proximity to a source population of seabirds and proximity to a
# refugia from predators). and island variables (island size and
# number of years since predator eradication).

[snip]
I can't tell without a reproducible example.
You're not making any obvious mistakes.  Can you send your
data or post it somewhere?

  Followups should probably go to the r-sig-mixed-models <at>
r-project.org mailing list ...
   
  Ben Bolker
#
http://r.789695.n4.nabble.com/file/n4618871/Data_for_list_serve.csv
Data_for_list_serve.csv 

Here is my data, hope this helps.

The "LESP CHUCKLE" , "FTSP FLIGHT", and "ANMU CHIRRUP" are the dependent
variables, I want to run one model for each.

So, again the desired model is:

mod <- glmmadmb(LESP.CHUCKLE~
Years.Erad+IS+Ref+Dist.Buldir+Food+Moon+Wind.Speed+(1|SITE/ISLAND),
data=callsna, 
zeroInflation=TRUE, family="nbinom") 

cheers!
Rachel


--
View this message in context: http://r.789695.n4.nabble.com/glmmADMB-tp4616701p4618871.html
Sent from the R help mailing list archive at Nabble.com.
#
Update!  

I changed the "site" categories.  I noticed that I had coded them as "North,
South, East, West" on different islands, which may have caused confusion in
the model.

Now I get a whole new error message!


Error in glmmadmb(LESP.CHUCKLE ~ 1 + (1 | SITE/ISLAND), data = callsna,  : 
  The function maximizer failed (couldn't find STD file)
In addition: Warning message:
running command 'C:\windows\system32\cmd.exe /c
"C:/Users/Rachel/Documents/R/win-library/2.14/glmmADMB/bin/windows32/glmmadmb.exe"
-maxfn 500 -maxph 5 -noinit -shess' had status 1 

I followed the instruction you gave to a similar error message posted in
google groups (I downloaded version 0.7 and installed it):
http://groups.google.com/group/admb-users/browse_thread/thread/56d665acfb756ac4

With no avail! Still get the same lousy error message!

The following models work ok: 

mod <- glmmadmb(LESP.CHUCKLE~ 1+(1|SITE), data=callsna, zeroInflation=TRUE,
family="nbinom")

and 

mod <- glmmadmb(LESP.CHUCKLE~ 1+(1|ISLAND), data=callsna,
zeroInflation=TRUE, family="nbinom")

Any thoughts?

Thanks so so much!

Rachel Buxton

--
View this message in context: http://r.789695.n4.nabble.com/glmmADMB-tp4616701p4619221.html
Sent from the R help mailing list archive at Nabble.com.
#
On Tue, May 8, 2012 at 5:16 PM, rbuxton <moyble at hotmail.com> wrote:
I've not succeeded in replicating your work, the data set has
something funny perhaps.

I saved  your file "data.csv" and ran this:

callsna <- read.table("data.csv", sep=",", header=T)

library(glmmADMB)

mod <- glmmadmb(LESP.CHUCKLE ~ Years.Erad + IS + Ref + Dist.Buldir +
Food+Moon+Wind.Speed + (1|SITE/ISLAND), data=callsna,
zeroInflation=TRUE, family="nbinom")

I don't get as far as you do.
Error in II[, ii] = II[, ii] + REmat$codes[[i]] :
  number of items to replace is not a multiple of replacement length
In addition: Warning messages:
1: In glmmadmb(LESP.CHUCKLE ~ Years.Erad + IS + Ref + Dist.Buldir +  :
  NAs removed in constructing fixed-effect model frame: you should
probably remove them manually, e.g. with na.omit()
2: In II[, ii] + REmat$codes[[i]] :
  longer object length is not a multiple of shorter object length
Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) :
  contrasts can be applied only to factors with 2 or more levels


I wondered if the function you are using is supposed to be able to do
that.  I looked back at the web page for glmmADMB (note
capitalization), http://glmmadmb.r-forge.r-project.org/ and it says:

"Zero-inflation (currently only as a single constant term across all groups)"

But I'll try again if you post your R code that works with that CSV
file you posed, I may try again.

pj

  
    
#
Hi there,

I am using R version 2.14.2, package glmmADMB

Here is the entire script:

calls <- read.csv(file.choose())
Error in glmmadmb(LESP.CHUCKLE ~ 1 + (1 | SITE/ISLAND), data = callsna,  : 
  The function maximizer failed (couldn't find STD file)
In addition: Warning message:
running command 'C:\windows\system32\cmd.exe /c
"C:/Users/Rachel/Documents/R/win-library/2.14/glmmADMB/bin/windows32/glmmadmb.exe"
-maxfn 500 -maxph 5 -noinit -shess' had status 1 

Here is my data:
http://r.789695.n4.nabble.com/file/n4621934/FOR_ANALYSIS.csv
FOR_ANALYSIS.csv 

If the data attachment isn't working properly, I can email it to you
directly

cheers!

Rachel

ps can you not use continuous random variables in glmmADMB?  When I try to
use the term (1|Day of year) - Day of year is a continuous random variable -
I get the following error message:
Error in Droplevels(eval(parse(text = x), data)) : 
  all grouping variables in random effects must be factors





--
View this message in context: http://r.789695.n4.nabble.com/glmmADMB-tp4616701p4621934.html
Sent from the R help mailing list archive at Nabble.com.