【发布时间】:2022-12-02 01:26:11
【问题描述】:
I want to use the R command 'boot' to calculate a bootstrapped mean. This doesn't work, though, and always returns the error message:
Error in mean.default(data, original, ...) :
'trim' must be numeric of length one
Here is an example of the code I am using:
df <- data.frame(
v1 <- c(0,159028,236220,9127,0,0),
v2 <- c(13, 42, 56, 9, 77, 34)
)
boot(df$v1, statistic = mean, R = 100)
Which returns the aforementioned error.
Why won't this command work? What can I do to resolve the issue?
【问题讨论】: