[R] Help with gamm errors

Simon Wood s.wood at bath.ac.uk
Wed Oct 10 18:41:48 CEST 2007


Rob,

Thanks for sending the example...
>
> m1=gamm(present~s(week,bs="cc")+s(week,bs="cc",by=y1),random=list(garden=~1
>) ,
>   correlation=corAR1(form=~1|garden),family=binomial,data=count.data2)
>
> (ie removing the week term). This model proceeds - to a point...
>
>  Maximum number of PQL iterations:  20
> iteration 1
> iteration 2
> iteration 3
> iteration 4
> iteration 5
> iteration 6
> Error: attempt to select less than one element

-- this relates to the fact that `gamm' assumes that the correlation structure 
is nested within the random effect grouping structure, so in fact the 
`|garden' in the correlation formula is redundant (see ?gamm on correlation). 
Clearly this should be dealt with more gracefully... I'll try to do so for 
the next release. In the meantime just remove the redundant grouping factor. 

best,
Simon

>
> Traceback() suggests that the model fits, but that lme can't calculate
> something?
>
> 2: extract.lme.cov2(ret$lme, mf, n.sr + 1)
> 1: gamm(present ~ s(week, bs = "cc") + s(week, bs = "cc", by = y1),
>        random = list(garden = ~1), correlation = corAR1(form = ~1 |
>            garden), family = binomial, data = count.data2)
>
> Question 2: Any hints on what might be causing this? Am I fitting the wrong
> (or too complicated a model)?
>
> Btw if it is relevant I am using mgcv_1.3-19 and R 2.3.1.
>
> Many thanks for any hints on where I should start digging
> Cheers
> rob
>
> *** Want to know about Britain's birds? Try  www.bto.org/birdfacts ***
>
> Dr Rob Robinson, Senior Population Biologist
> British Trust for Ornithology, The Nunnery, Thetford, Norfolk, IP24 2PU
> Ph: +44 (0)1842 750050         E: rob.robinson at bto.org
> Fx: +44 (0)1842 750030         W: http://www.bto.org
> eSafe scanned this email for viruses, vandals and malicious content (!)
>
> ==== "How can anyone be enlightened, when truth is so poorly lit" =====
>
> ______________________________________________
> R-help at 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.

-- 
> Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK
> +44 1225 386603  www.maths.bath.ac.uk/~sw283



More information about the R-help mailing list