The boot function doesn't seem to work for 66k resamples. The documentation doesn't seem to have any limits for the number of resamples and it works fine with a smaller number of resamples.
Here's some sample code:
library(boot)
library(data.table)
mean_i <- function(x, i) {
mean(x[i])
}
set.seed(1)
x <- data.table(yr = sample(1:5, 66000, replace = TRUE),
amount = sample(-100000:100000, 66000, replace = TRUE))
boot(x[, amount], statistic = mean_i, R = length(x[, amount]))
This gives the error:
Error in sample.int(n, n * R, replace = TRUE) : vector size cannot be NA
but
boot(x[1:100, amount], statistic = mean_i, R = length(x[1:100, amount]))
works fine.
Does anyone know if there's a maximum number for resamples or what could be causing the error?