3

I want to use the bootMer() feature of the lme4 package using linear mixed model and also using boot.ci to get 95% CIs by parametric bootstrapping, and have been getting the warnings of the type "In bootMer(object, bootFun, nsim = nsim, ...) : some bootstrap runs failed (30/100)”. My code is:

> lmer(LLA ~ 1 +(1|PopID/FamID), data=fp1) -> LLA
> LLA.boot <- bootMer(LLA, qst, nsim=999, use.u=F, type="parametric")
Warning message:
In bootMer(LLA, qst, nsim = 999, use.u = F, type = "parametric") :
  some bootstrap runs failed (3/999)
> boot.ci(LLA.boot,   type=c("norm", "basic", "perc"))
BOOTSTRAP CONFIDENCE INTERVAL CALCULATIONS
Based on 996 bootstrap replicates

CALL : 
boot.ci(boot.out = LLA.boot, type = c("norm", "basic", "perc"))

Intervals : 
Level      Normal              Basic              Percentile     
95%   (-0.2424,  1.0637 )   (-0.1861,  0.8139 )   ( 0.0000,  1.0000 )  
Calculations and Intervals on Original Scale

my problem is why Bootstrap fails for a few values ? and Confidence interval estimated using boot.ci at 95% show negative value, though there are no negative values in the array of values generated by bootstrap.'

The result of plot(LLA.boot):

enter image description here

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
amy
  • 51
  • 2
  • 4
    Welcome to Stack Overflow. With R questions, it's really useful if you can provide a reproducible example, instructions here: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – Phil May 14 '15 at 11:08

1 Answers1

3

It's not surprising, for a slightly difficult or unstable model, that a few parametric bootstrap runs might fail to converge for numerical reasons. You should be able to retrieve the specific error messages via attr(LLA.boot,"boot.fail.msgs") (this really should be documented, but isn't ...) In general I wouldn't worry about it too much if the failure fraction is very small (which it is in this case); if were large (say >5-10%) I would revisit my data and model and try to see if there was something else wrong that was manifesting itself in this way.

As for the confidence intervals: the "basic" and "norm" methods use Normal and bias-corrected Normal approximations, respectively, so it's not surprising that intervals should go beyond the range of the computed values. Since your function is

Qst <- function(x){
   uu <- unlist(VarCorr(x))
   uu[2]/(uu[3]+uu[2])}
}

its possible range is from 0 to 1, and your percentile bootstrap CI shows this range is attained. If your model were perfectly uninformative, the distribution of Qst would be uniform (mean=0.5, sd=sqrt(1/12)=0.288) and the Normal approximation to the CI would be

> 0.5+c(-1,1)*1.96*sqrt(1/12)
[1] -0.06580326  1.06580326

The upper end is about in the same place as your Normal CI, but your lower limit is even smaller, suggesting that there may even be some bimodality in the sampling distribution of your estimate (this is confirmed by the distribution plot you posted). In any case, I suspect that the bottom line is that your confidence intervals (however computed) are so wide that they're telling you that your data provide almost no practical information about the value of Qst ... In particular, it looks like the majority of your bootstrap replicates are finding singular fits, in which one or the other of the variances are estimated as zero. I'm guessing your data set is just not large enough to estimate these variances very precisely.

For more information on how the Normal and bias-corrected Normal approximations are computed, see boot:::basic.ci and boot:::norm.ci or chapter 5 of Davison and Hinkley as cited in ?boot.ci.

Ben Bolker
  • 211,554
  • 25
  • 370
  • 453
  • Thanks for your reply! as suggested i run this command in r and got no errors >attr(LLA.boot,"boot.fail.msgs") NULL Plot for LLA shown in this link - http://www.pdf.investintech.com/preview/cb9580f0-fac9-11e4-b21a-002590d31986/index.html. i would also like to know why the range of ci is so broad and shows negative value though its not logically possible to have negative value for the function used. – amy May 15 '15 at 06:27
  • sorry, I meant `plot(LLA.boot)` ... I answered your second question, but perhaps you didn't understand my answer? Can you please show us what `qst` is? – Ben Bolker May 15 '15 at 09:34
  • Thanks. Qst <- function(x){unlist(VarCorr(x))[2]/(unlist(VarCorr(x))[3]+unlist(VarCorr(x))[2])}. The plot for LLA.boot shown in this link - https://testcloud.idrsolutions.com:8181/HTML_Page_Extraction/output/d11e21ea-df92-48a8-ae35-ae61b0606946/LLA_boot/index.html – amy May 15 '15 at 12:54
  • Sorry for the inconvenient. And the plot(LLA.boot) shown in this link - http://imgur.com/vnqMCfh – amy May 18 '15 at 05:02