1

I am trying to use bootstrapping to derive errors around my parameter estimate for the fixed effects in the following model. It is simply estimating the number of times an animal might cross a road based on the road's distance from a stream.

When I run the nlme model it does converge and all is well. I have tried several different methods to do the bootstrapping but have been unsuccessful. I have tried both using the boot package and simply developing a bit of code that resamples my data and drops the parameter estimates into new vectors.

Below is my attempt at the later and the resulting error messages. Any help would be greatly appreciated.

bv <- numeric(100)
cv <- numeric(100)
for(i in 1:100){
  ss <- sample(1:130, replace=T)
  y <- nwfcross[ss]
  x <- nwfdist[ss]
  modelb <- nlme(y~a*exp(-b*x), fixed=a+b~1, 
         random=a+b~1|nwfid, start=c(a=300,b=0.016))
  bv[i] <- coef(modelb)[1]
  cv[i] <- coef(modelb)[2]
}

Error in nlme.formula(y ~ a * exp(-b * x), fixed = a + b ~ 1, random = a +  : 
  Maximum number of iterations reached without convergence
In addition: There were 50 or more warnings (use warnings() to see the first 50)

Warning messages:

1: Singular precision matrix in level -1, block 1
2: Singular precision matrix in level -1, block 1
3: Singular precision matrix in level -1, block 1….
angabriel
  • 4,979
  • 2
  • 35
  • 37
  • 2
    To get a good answer, you need to make your example reproducible. I can't run your code, since I don't have access to `nwfcross` - see http://stackoverflow.com/q/5963269/203420 for tips. – csgillespie Jan 09 '12 at 17:08
  • 1
    `P(chicken crosses road) = 1` – Richie Cotton Jan 09 '12 at 17:30
  • I bet you don't have enough data on some of your `newfid`s in the bootstrap samples. You should probably be bootstrapping on the `newfid`s anyway as you're treating that as a random effect; however if you do that, you'll need to make sure that repeated instances of a `newfid` are treated as new individuals. You should probably read up on bootstrapping with random effects; there may be more details you need to think about than I've mentioned here. – Aaron left Stack Overflow Jan 09 '12 at 17:47
  • See this question over at stats.stackexchange for some ideas and links to some possibly useful papers: http://stats.stackexchange.com/q/1399/3601 – Aaron left Stack Overflow Jan 09 '12 at 17:52
  • Working on trying to provide a subset of the data - getting info into this site in an appropriate manner is proving a little tough. Aaron, I thought by leaving the nwfid (individual animal ids, and my random variable) out of the lines in which I defined my subsampling (e.g., x<-nwfdist[ss]) I was boostrapping across the entire set of samples rather than the random variable. – ScratchnDent Jan 10 '12 at 15:53

0 Answers0