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….