Hello,
I am using R.12.2.0. I am trying to generate bootstrap confidence intervals
using bootcov from the rms package. I am able to impute the missing data
using aregImpute and to perform a linear regression on the imputed datasets
using fit.mult.impute, but I am unable to use bootcov to generate the
confidence intervals for the R-squared. Here is a small example that should
duplicate the error message that I am getting:
library(rms)
test <-
structure(list(a = c(32, 31, 30, 29, NA, 32, 26, 25, 34, 29,
28, 27, 25, 20, 30, 33, 23, 29, 25, 26, 26, 29, 24, 30, 30, 27,
29, 23, 21, 30, 24, 33, 30, 27, 24, NA, 24, 22, 27, 28, 23, 26,
25, 35, 32, 26, 22, 27, 39, 28, 25, 22, 25, 40, 32, 31, 32, 36,
27, 30, 23, 24, 25, 29, 25, NA, 30, 29, 31, 33, 29, 27, 18, 33,
25, 27, 27, 24, 29, 28, 27, 25, 27, 31, 23, 25, 32, 25, 25, 29,
27, 25, 28, 26, 27, 22, 33, 26, 32, 34), b = c(NA, NA, NA, 10,
0, NA, 4, 1, NA, 14, NA, NA, 1, 10, 21, 7, 17, 2, 5, NA, 2, NA,
NA, NA, NA, 18, 3, 3, 10, NA, 7, NA, 8, NA, NA, 33, NA, NA, NA,
14, NA, NA, NA, NA, 14, 1, 5, NA, NA, NA, NA, 6, 2, NA, NA, 8,
14, NA, NA, NA, 10, NA, 18, NA, NA, 15, 19, NA, NA, 12, NA, NA,
NA, NA, 25, NA, NA, NA, 17, NA, NA, 15, 10, NA, 1, NA, 3, 11,
NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA)), .Names = c("a",
"b"), row.names = c(NA, 100L), class = "data.frame")
gm <- aregImpute(formula = ~ a + b, data=test,n.impute=10)
ddist=datadist(test)
fmi=fit.mult.impute(log(a +1)~ b, ols, xtrans = gm, data =
test,x=TRUE,y=TRUE)
f <- bootcov(fmi,stat='R2') #Error is here; I get the error "Error in
stats[b] <- f$stats[stat] : replacement has length zero"
quantile(f$boot.stats,probs=c(0.025,0.975)) # I am unable to run this to get
the 95% CI for R2.
Any help would be greatly appreciated. Thanks so much.
Kim
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
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.