# BUG: Apparently, bcajack loses the final element of a vector when that final element has been included in a subset.
#
# ----------------------------------------------------------------------------
# This does NOT work (produces NAs for the BCA confidence interval limits).
# ----------------------------------------------------------------------------
myData <- c(4,8,2,5,4,6,7,7,1,8,2,2,5,3,6,7,3,6,2,2,1,9,3,2,335)
myFunction <- function(k) {
myStat <- mean(k[1:25]) # This causes bcajack to produce NAs for the BCA confidence limits
# because the subset includes the final value in the input-vector.
return(myStat)
}
set.seed(5)
myBcaResult <- bcajack(x = myData, B = 5000, func = myFunction,
verbose = FALSE, alpha = c(0.001,0.01,0.05))
myBcaResult
#
# ----------------------------------------------------------------------------
# This DOES work since the function doesn't use the final value of the input vector.
# ----------------------------------------------------------------------------
myData <- c(4,8,2,5,4,6,7,7,1,8,2,2,5,3,6,7,3,6,2,2,1,9,3,2,335)
myFunction <- function(k) {
myStat <- mean(k[1:24]) # This produces proper output
# since the subsetting excludes the input-vector's final value.
return(myStat)
}
set.seed(5)
myBcaResult <- bcajack(x = myData, B = 5000, func = myFunction,
verbose = FALSE, alpha = c(0.001,0.01,0.05))
myBcaResult
# ----------------------------------------------------------------------------
# This DOES work, since there's no subsetting.
# ----------------------------------------------------------------------------
myData <- c(4,8,2,5,4,6,7,7,1,8,2,2,5,3,6,7,3,6,2,2,1,9,3,2,335)
myFunction <- function(k) {
myStat <- mean(k) # This produces proper output
# since there's no subsetting.
return(myStat)
}
set.seed(5)
myBcaResult <- bcajack(x = myData, B = 5000, func = myFunction,
verbose = FALSE, alpha = c(0.001,0.01,0.05))
myBcaResult
@bnaras