Hope one of you could help with the following question/problem: We would like to explain the spatial distribution of juvenile fish. We have 2135 records, from 75 vessels (code_tripnr) and 7 to 39 observations for each vessel, hence the random effect for code_tripnr. The offset (offsetter) accounts for the haul duration and sub sampling factor. There are no extreme outliers in lat/lon. The model we try to fit is: > gamm3<-gamm(count~offset(offsetter)+s(lon,lat),random=list(code_tripnr=~1),family="poisson", niterPQL=200) Maximum number of PQL iterations: 200 iteration 1 iteration 2 Error in MEestimate(lmeSt, grps) : NA/NaN/Inf in foreign function call (arg 1) We tried several things. We added some noise to lon and lat, modelled the density instead of using a count with model offset, and we normalized the explanatory variables. We also changed several settings (see models below). Interestingly, we do manage to fit a more complex model: gamm2<-gamm(count~offset(offsetter)+ s(lat,lon,year,dayofyear), random=list(code_tripnr=~1),family="poisson", correlation = corGaus(0.1, form=~lat + lon)) The models are fitted using mgcv 1.4-1 and R 2.7.1 on a 64Bits Debian OS. So there seems to be a convergence problem, correct? And does someone have an idea what might cause this? Secondly are there some tricks/solutions. E.g. perhaps we could use the results from the more complex model (gamm2 above), but I do not know exactly how. All help/advice would be greatly appreciated. Kind regards, Geert > gamm3<-gamm(count~offset(offsetter)+s(lon,lat), random=list(code_tripnr=~1),family="poisson", correlation = corExp(1, form=~X + Y),nite rPQL=200) Maximum number of PQL iterations: 200 iteration 1 iteration 2 Error in recalc.corSpatial(object[[i]], conLin) : NA/NaN/Inf in foreign function call (arg 1) > gamm3<-gamm(count~offset(offsetter)+s(lon,lat,k=c(1,1)),random=list(code_tripnr=~1),family="poisson", niterPQL=200) Maximum number of PQL iterations: 200 iteration 1 iteration 2 Error in lme.formula(fixed = fixed, random = random, data = data, correlation = correlation, : nlminb problem, convergence error code = 1 message = false convergence (8) In addition: Warning messages: 1: In if (k < M + 1) { : the condition has length > 1 and only the first element will be used .Options$mgcv.vc.logrange=0.001 # we also tried higher settings > gamm3<-gamm(count~offset(offsetter)+s(lon,lat),random=list(code_tripnr=~1),family="poisson", niterPQL=200, control=lmeControl(opt="optim")) Maximum number of PQL iterations: 200 iteration 1 iteration 2 Error in optim(c(coef(lmeSt)), function(lmePars) -logLik(lmeSt, lmePars), : initial value in 'vmmin' is not finite gamm3<-gamm(count~offset(offsetter)+s(lon,lat),random=list(code_tripnr=~1),family="poisson", niterPQL=200,control=lmeControl(minAbsParApV ar=0.0000000000001)) Maximum number of PQL iterations: 200 iteration 1 iteration 2 Error in recalc.corSpatial(object[[i]], conLin) : NA/NaN/Inf in foreign function call (arg 1) > gamm3<-gamm(count~offset(offsetter)+s(lon,lat),random=list(code_tripnr=~1),family="poisson", niterPQL=200) Maximum number of PQL iterations: 200 iteration 1 iteration 2 Error in MEestimate(lmeSt, grps) : NA/NaN/Inf in foreign function call (arg 1) > gamm3<-gamm(count~offset(offsetter)+s(lon,lat,k=c(1,1)),random=list(code_tripnr=~1),family="poisson", niterPQL=200) Maximum number of PQL iterations: 200 iteration 1 iteration 2 Error in lme.formula(fixed = fixed, random = random, data = data, correlation = correlation, : nlminb problem, convergence error code = 1 message = false convergence (8) In addition: Warning messages: 1: In if (k < M + 1) { : the condition has length > 1 and only the first element will be used 2: In smooth.construct.tp.smooth.spec(object, dk$data, dk$knots) : basis dimension, k, increased to minimum possible > gamm3<-gamm(count~offset(offsetter)+s(lon,lat,k=c(8,8)),random=list(code_tripnr=~1),family="poisson", niterPQL=200) Maximum number of PQL iterations: 200 iteration 1 iteration 2 Error in lme.formula(fixed = fixed, random = random, data = data, correlation = correlation, : nlminb problem, convergence error code = 1 message = false convergence (8) In addition: Warning messages: 1: In if (k < M + 1) { : the condition has length > 1 and only the first element will be used 2: In 1:UZ.len : numerical expression has 2 elements: only the first used 3: In if (p.rank > ncol(XZ)) p.rank <- ncol(XZ) : the condition has length > 1 and only the first element will be used 4: In 1:p.rank : numerical expression has 2 elements: only the first used 5: In if (p.rank < k - j) Xf <- XZU[, (p.rank + 1):(k - j), drop = FALSE] else Xf <- matrix(0, : the condition has length > 1 and only the first element will be used 6: In (p.rank + 1):(k - j) : numerical expression has 2 elements: only the first used 7: In 1:p.rank : numerical expression has 2 elements: only the first used > gamm3<-gamm(count~offset(offsetter)+s(lon,lat,k=c(4,4),fx=T),random=list(code_tripnr=~1),family="poisson", niterPQL=200) Maximum number of PQL iterations: 200 iteration 1 iteration 2 Error in MEestimate(lmeSt, grps) : NA/NaN/Inf in foreign function call (arg 1) In addition: Warning messages: 1: In if (k < M + 1) { : the condition has length > 1 and only the first element will be used 2: In 1:UZ.len : numerical expression has 2 elements: only the first used > gamm3<-gamm(count~offset(offsetter)+te(lon,lat),random=list(code_tripnr=~1),family="poisson", niterPQL=200,control=lmeControl(opt="opti m")) Maximum number of PQL iterations: 200 iteration 1 iteration 2 Error in optim(c(coef(lmeSt)), function(lmePars) -logLik(lmeSt, lmePars), : initial value in 'vmmin' is not finite > gamm3<-gamm(count~offset(offsetter)+s(lon,lat),random=list(code_tripnr=~1),family="poisson", niterPQL=200,control=lmeControl(tolerance= 0.00000000000001)) Maximum number of PQL iterations: 200 iteration 1 iteration 2 Error in MEestimate(lmeSt, grps) : NA/NaN/Inf in foreign function call (arg 1) > gamm3<-gamm(count~offset(offsetter)+s(lon,lat),random=list(code_tripnr=~1),family="poisson", niterPQL=200,control=lmeControl(niterEM=200)) Maximum number of PQL iterations: 200 iteration 1 iteration 2 Error in MEestimate(lmeSt, grps) : NA/NaN/Inf in foreign function call (arg 1) > gamm3<-gamm(count~offset(offsetter)+s(lon,lat),random=list(code_tripnr=~1),family="poisson", niterPQL=200,control=lmeControl(msTol=0.00000000000000001)) Maximum number of PQL iterations: 200 iteration 1 iteration 2 Error in MEestimate(lmeSt, grps) : NA/NaN/Inf in foreign function call (arg 1) > gamm3<-gamm(count~offset(offsetter)+s(lon,lat),random=list(code_tripnr=~1),family="poisson", niterPQL=200,control=lmeControl(.relStep=0.00000000000000000001)) Maximum number of PQL iterations: 200 iteration 1 iteration 2 Error in MEestimate(lmeSt, grps) : NA/NaN/Inf in foreign function call (arg 1) > gamm3<-gamm(count~offset(offsetter)+s(lon,lat),random=list(code_tripnr=~1),family="poisson", niterPQL=200,control=lmeControl(nlmStepMax=0.00000000000000000001)) Maximum number of PQL iterations: 200 iteration 1 iteration 2 Error in MEestimate(lmeSt, grps) : NA/NaN/Inf in foreign function call (arg 1) > gamm3<-gamm(count~offset(offsetter)+s(lon,lat),random=list(code_tripnr=~1),family="poisson", niterPQL=200,control=lmeControl(minAbsParApVar=0.0000000000001)) Maximum number of PQL iterations: 200 iteration 1 iteration 2 Error in MEestimate(lmeSt, grps) : NA/NaN/Inf in foreign function call (arg 1) > gamm3<-gamm(count~offset(offsetter)+s(lon,lat),random=list(code_tripnr=~1),family="poisson", niterPQL=200, control=lmeControl(returnObject=T)) Maximum number of PQL iterations: 200 iteration 1 iteration 2 Error in MEestimate(lmeSt, grps) : Singularity in backsolve at level 0, block 1 In addition: Warning messages: 1: In logLik.reStruct(object, conLin) : Singular precision matrix in level -1, block 1 2: In logLik.reStruct(object, conLin) : Singular precision matrix in level -1, block 1 3: In logLik.reStruct(object, conLin) : Singular precision matrix in level -1, block 1 4: In logLik.reStruct(object, conLin) : Singular precision matrix in level -1, block 1 5: In logLik.reStruct(object, conLin) : Singular precision matrix in level -1, block 1 6: In MEestimate(lmeSt, grps) : Singular precision matrix in level -1, block 1 _________________________________________________________________ [[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.