Dear list

I try to run a bootstrap with lmer.

I often, but not always, get the error message:

Error in objective(.par, ...) :
   Leading minor of order 6 in downdated X'X is not positive definite

(with the number (here 6) varying)


In R-archives I came across some threads that treated this problem, 
nevertheless they refer to lmer when using it with family = "binomial", so 
the solutions that were offered did not solve my problem 
(family="quasipoisson") (e.g. adding 
control=list(usePQL=FALSE,msVerbose=TRUE) does not make sense nor changes 
anything - error remains).

A sample data (d.rba) set is pasted at the end.

attach (d.rba)
y <- d.rba$ms
cut2 <- d.rba$cut^2

boot <- 10
index <- seq(1, length(y), 1)
cut.pred <- seq(0,20,2)
cut2.pred<-cut.pred^2
pred <- matrix(data = NA, nrow=boot, ncol=length(cut.pred))


for (j in 1 : boot){

id <- sample(index, replace=T)

y.boot <- y[id]
age_insects.boot <- age_insects[id]
cut.boot <- cut[id]
cut2.boot <- cut2[id]
rV.rGb.boot <- rV.rGb[id]
ECON_MN.boot <- ECON_MN[id]
SHDI.boot <- SHDI[id]
city.boot <- city[id]

lmer.5 <-lmer(y.boot ~ cut.boot + cut2.boot + rV.rGb.boot + 
age_insects.boot +  ECON_MN.boot + SHDI.boot + 
(1|city.boot),family="quasipoisson")


for (i in 1:length(cut.pred)){
     pred[j,i] <- exp (lmer.5@fixef[1] + lmer.5@fixef[2]*cut.pred[i] + 
lmer.5@fixef[3]*cut2.pred[i] + lmer.5@fixef[4]* 
mean(rV.rGb)+lmer.5@fixef[5]*mean(age_insects) + 
lmer.5@fixef[6]*mean(ECON_MN) + lmer.5@fixef[7]*mean(SHDI))
     }
}



 >sessionInfo()
R version 2.6.0 (2007-10-03)
i386-pc-mingw32

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] lme4_0.99875-9    Matrix_0.999375-4 lattice_0.16-5

loaded via a namespace (and not attached):
[1] grid_2.6.0  nlme_3.1-85


I found two hypothesis that could be the source of the problem but I cannot 
figure out how to test them nor how to solve them.
1) it's a loop-matrix interaction (=batch-) problem. Even though I 
sometimes do get the error message when I run it individually. Nevertheless 
this was suggested as the potential error in one response but no solution 
was offered (http://tolstoy.newcastle.edu.au/R/e2/help/06/10/2918.html)
2) the selected samples out of my data set ("id") to run the predictions 
create the problem (maybe if some x values = 0?)

Thanks a lot for your time! I very much appreciate the help.

Thomas



Here a chunk of the data:

(n = 30, ntotal = 96)

location ms cut age_insects city rV.rGb ECON_MN SHDI
101 328 3 6 ZH 78.46 32.13 0.926
102 211 8 2 ZH 77.60 7.54 0.614
103 306 1 3 ZH 60.23 20.57 0.831
104 195 3 1 ZH 67.48 18.33 0.872
105 232 11 49 ZH 58.90 8.67 0.682
106 291 2 20 ZH 2.49 70.45 0.637
107 297 9 44 ZH 22.85 5.73 0.522
108 281 11 55 ZH 47.71 7.83 0.533
109 278 5 54 ZH 48.10 23.81 0.657
110 309 12 36 ZH 23.57 42.95 0.346
201 256 12 34 LU 42.03 8.61 0.528
202 240 8 10 LU 58.88 8.50 0.680
203 274 3 3 LU 62.23 47.09 1.070
204 305 7 46 LU 55.33 21.95 0.722
205 269 9 86 LU 7.72 29.87 0.896
206 367 9 49 LU 42.13 33.77 0.932
207 249 10 12 LU 39.22 13.36 0.964
208 336 2 21 LU 15.03 55.44 0.814
209 190 6 4 LU 70.16 12.00 0.744
210 302 6 71 LU 78.45 7.27 0.645
301 258 6 31 LG 73.64 7.80 0.669
302 257 11 36 LG 69.70 20.90 0.716
303 323 12 20 LG 56.42 19.70 0.522
304 213 20 13 LG 47.55 18.00 0.908
305 261 12 14 LG 61.13 8.18 0.511
306 169 12 1 LG 47.90 31.28 0.761
307 242 9 30 LG 42.68 7.47 0.417
308 222 12 16 LG 31.73 16.14 0.742
309 255 5 36 LG 80.45 7.48 0.666
310 320 2 71 LG 64.24 31.96 0.676


_______________________________________________

Thomas Sattler

Swiss Federal Research Institute WSL
Bellinzona, Birmensdorf

& Conservation Biology
Institute of Ecology and Evolution (IEE), University of Bern

<http://www.wsl.ch/personal_homepages/sattler>http://www.wsl.ch/personal_homepages/sattler  
	[[alternative HTML version deleted]]

