[ADMB Users] glmmadbm error in REmat$codes

Ben Bolker bbolker at gmail.com
Fri Jan 18 09:24:40 PST 2013


On 13-01-18 11:45 AM, Mollie Brooks wrote:
> Hi Sheryn,
> 
> This might be more of an R-sig-mixed question than an R question, but
> it's too soon to tell, so I'll give a few suggestions. 
> 
> Did you really have 39 treatment levels? You don't have enough data to
> estimate as many parameters as you're trying to fit: 39*2 fixed effect +
> 5 random effect parameters. Could some of the stand types be grouped
> together? Or could you leave out the interaction? Even without the
> interaction, there still isn't enough data for the rule of thumb
> requiring at least 10 data points per parameter.
> 
> Did you mean to specify a logit link? A log link is more standard with
> nbinom models. It is the default so you don't need to specify the link
> in addition to family.
> 
> Equal sample sizes are not an issue.
> 
> cheers,
> Mollie
> 
> 
> Mollie Brooks
> Postdoctoral Researcher, Ponciano Lab
> Biology Department, University of Florida
> http://people.biology.ufl.edu/mbrooks
> 
> 
> On 18 Jan 2013, at 11:22 AM, Sheryn Olson wrote:
> 
>> Hello,
>>
>> Using R ver 2.15.2, package glmmADMB_0.7.3 in Win7,  I've been
>> attempting to run a negative binomial model to determine the effects
>> of season and forest stand types on snowshoe hare pellet densities.  
>> Year is a random (nuisance) variable.  Each stand type (treatment) has
>> unequal sample sizes that vary by year.   The count data are
>> constrained at zero, zero inflated, and range from 0 - 990 (residuals
>> show overdispersion).
>>
>> Data Structure:
>>
>> > str(ps)
>> 'data.frame':   387 obs. of  7 variables:
>>  $ year     : Factor w/ 5 levels "2008","2009",..: 1 1 1 1 1 1 1 1 1 1 ...
>>  $ season : Factor w/ 2 levels "Smr","Wtr": 1 1 1 1 1 1 1 1 1 1 ...
>>  $ stand    : Factor w/ 39 levels "AF1","AF2","AF3",..: 32 33 25 27 26
>> 34 23 31 24 28 ...
>>  $ stndtyp: Factor w/ 3 levels "MT","RG","SEL": 1 1 1 1 1 1 1 1 1 1 ...
>>  $ pellets:  int  1 1 2 2 4 5 7 9 12 13 ...
>>  $ days   : num  114 114 127 127 127 127 122 112 115 112 ...
>>  $ ln.days: num  4.74 4.74 4.84 4.84 4.84 ...
>>
>> Model:
>> >  nb1 <- glmmadmb(pellets ~ season * stndtyp + offset(ln.days) +
>> (1|year), na.omit, data=ps,family="nbinom", link="logit")
>>
>>     Warning in glmmadmb(pellets ~ season * stndtyp + offset(ln.days) +
>> (1 |  :
>>       NAs removed in constructing fixed-effect model frame: you should
>> probably remove them manually, e.g. with na.omit()


  I would take this warning very seriously.  I'm not sure what effect
specifying "na.omit" in the position you have it would be having -- I
would use

nb1 <- glmmadmb(pellets ~ season * stndtyp +
  offset(ln.days) + (1|year), data=na.omit(ps),family="nbinom")

 (i.e. also following Mollie's advice to use the default log link rather
than a logit unless you really know what you're doing.)
Theta should be automatically estimated.

>>     Warning in II[, ii] + REmat$codes[[i]] :
>>       longer object length is not a multiple of shorter object length
>>     Error in II[, ii] = II[, ii] + REmat$codes[[i]] :
>>       number of items to replace is not a multiple of replacement length
>>
>> Are there syntax problems? - with the na.omit and random
>> specification.  Model problems? - with unequal sample sizes, or wrong
>> specification of the link.   Do the algorithms require equal sample sizes?
>> I'm also confused about how to know what value of theta to specify,
>> and when it is appropriate to specify?
>>
>> Thanks all.
>> -- 
>> Sheryn Olson
>> Graduate Research Assistant, The University of Maine
>>
>> _______________________________________________
>> Users mailing list
>> Users at admb-project.org <mailto:Users at admb-project.org>
>> http://lists.admb-project.org/mailman/listinfo/users
> 
> 
> 
> _______________________________________________
> Users mailing list
> Users at admb-project.org
> http://lists.admb-project.org/mailman/listinfo/users
> 




More information about the Users mailing list