[R] mcv package gamm function Error in chol(XVX + S)

Simon Wood s.wood at bath.ac.uk
Wed Oct 3 11:49:57 CEST 2007


Thanks for sending the data...

The problem is triggered by only having one observation per district, so that 
you have a random effect for each datum. This causes the correlation of the 
parameter estimates/predictions for the smooth term to become so high that 
covariance matrix of the smooth coefficients is no longer +ve definite. You 
can easily see the very high correlations by replacing the smooth with a low 
order polynomial in lon and lat and fitting with glmmPQL --- the correlation 
for the fixed effect parameters is rather high. I can patch gamm so that it 
provides an answer anyway: but it will only produce extremely high variance 
estimates for the smooth, reflecting the fundamental identifiability problem 
in separating the smooth variation from the random effect for a model with a 
random effect for each datum. 

best,
Simon

On Tuesday 02 October 2007 15:50, Dae-Jin Lee wrote:
> Hi all R users !
>
> I'm using gamm function from Simon Wood's mgcv package, to fit a spatial
> regression Generalized Additive Mixed Model, as covariates I have the
> geographical longitude and latitude locations of indexed data. I include a
> random effect for each district (dist) so the code is
>
> fit <- gamm(y~s(lon,lat,bs="tp", m=2)+offset(log(exp.)),
> random=list(dist=~1), family="poisson", niterPQL=30)
>
> when I run the gamm function I obtain the next error message:
>
> %%%
>  Maximum number of PQL iterations:  30
> iteration 1
> iteration 2
> ...
> iteration 8
> iteration 9
> iteration 10
> Error in chol(XVX + S) : the leading minor of order 29 is not positive
> definite
> %%%
>
> Could be any problem in gamm() ???
>
> --
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> 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