I am trying to compare different models using the same data. I am running R version 3.6.1 (which seems to have problems of its own— especially in downloading packages). This is what I am trying to do:
bs <- function(formula=model1, data=my_data, R=1000)
{
d <- my_data[R=1000,]
fit <- lm(formula=model1, data=my_data)
return(coef(fit))
}
results <- boot(data=my_data, statistic=bs, R=1000, formula=model1)
plot(results, index=1) # intercept
plot(results, index=2) # wt
plot(results, index=3) # disp
boot.ci(results, type="bca", index=1) # intercept
boot.ci(results, type="bca", index=2) # wt
boot.ci(results, type="bca", index=3) # disp
EVERY TIME I try to run this code, I get this error:
Error in `[.data.table`(my_data, R = 1000, ) : unused argument (R = 1000)
If I remove the R variable from the last line, I get this error:
Error in index.array(n, R, sim, strata, m, L, weights) : argument "R" is missing, with no default
I'm neither a statistician nor a programmer, just a confused biologist hoping to understand what I'm looking at— how can the argument be unused AND be missing without a default? What am I doing wrong?
Thank you for your help!!