[R] BIG difficulties in Using boot.ci (bot package)

varin sacha varinsacha at yahoo.fr
Mon Apr 13 15:38:45 CEST 2015


Hi Jean,

Many thanks, I got it but there is still a problem. When trying to bootstrap the confidence intervals, I get these messages. 
 

boot.ci(results,type="bca",index=1) 
[1] "All values of t are equal to  5.75620151906917 \n Cannot calculate confidence intervals"
NULL
> boot.ci(results,type="bca",index=2) 
[1] "All values of t are equal to  0.618293471234648 \n Cannot calculate confidence intervals"
NULL
> boot.ci(results,type="bca",index=3)
[1] "All values of t are equal to  0.148068842921784 \n Cannot calculate confidence intervals"
NULL


Here is the reproducible example :

GDP.LOG <-c(14,12,13,15.5,16,17,16.5,13.5,12.5,12)  
Quality.score <-c(12,11,13,14,15,16,12,10,9,9) 
Competitivness.score=c(8,6,7,5,6.5,7,8,4.5,6,7)
fit <- lm(formula = GDP.LOG ~ Quality.score + Competitivness.score) 
install.packages("boot") 
library(boot) 
bs=function(formula,data,indices){ 
d=data[indices,] 
fit=lm(formula,data=Dataset) 
return(coef(fit)) 
} 
results=boot(data=Dataset,statistic=bs, R=2000,formula= GDP.LOG ~ Quality.score + Competitivness.score) 
boot.ci(results,type="bca",index=1) 
boot.ci(results,type="bca",index=2) 
boot.ci(results,type="bca",index=3) 

How to solve that problem ?

Best,
S.



________________________________
De : "Adams, Jean" <jvadams at usgs.gov>

Cc : "r-help at r-project.org" <r-help at r-project.org> 
Envoyé le : Lundi 13 avril 2015 14h22
Objet : Re: [R] BIG difficulties in Using boot.ci (bot package)



S,

There is no mention of a type="bca" argument on the ?confint help file.

You can look here for an example of using the boot.ci() function in the boot package: 
http://www.statmethods.net/advstats/bootstrapping.html
>
>​Jean​







Dear R-Experts,
>
>I am trying to compute the BCa nonparametric bootstrap on regression coefficients.
>
>Here is the reproducible example :
>
>GDP.LOG <-c(14,12,13,15.5,16,17,16.5,13.5,12.5,12)
>Quality.score <-c(12,11,13,14,15,16,12,10,9,9)
>Competitivness.score=c(8,6,7,5,6.5,7,8,4.5,6,7)
>fit <- lm(formula = GDP.LOG ~ Quality.score + Competitivness.score)
>confint(fit, level=.95)
>confint.default(fit, level=.95)
>confint(fit,level=.95,type="bca")
>
>I am not sure but I think that I can not get the nonparametric BCa bootstrap with the confint function. As you can see, I have tried the argument type="bca", I don’t get any error message, but the results don’t change, the results are exactly the same as confint(fit,level=.95).
>As I have understood, the default argument uses normal quantiles and the method for linear models uses T-quantiles instead.
>So, I have checked the boot package and the boot.ci function to calculate the BCa bootstrap on the regression coefficients, but I don’t really understand how to compute the code.
>So, any help from you would be highly appreciated.
>
>Best,
>S
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>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.



More information about the R-help mailing list