Function to obtain a sampling distribution of means by bootstrapping.
boot.mean(x, B, n = length(x))
original sample, given as a numeric or logical object, to be used to generate bootstrapped samples.
number of bootstrapped samples to be generated by randomly sampling with replacement.
size of each bootstrapped sample. Default setting is the size of the original sample.
A list with components:
number of bootstrapped means computed.
mean of bootstrapped means.
standard error, estimated as the standard deviation of bootstrapped means.
means of bootstrapped samples.
# NOT RUN { # using simple vector a = 1:10 set.seed(1234) boot.mean(a, B = 500) # using variable from data frame set.seed(1234) boot.mean(Framingham$AGE3, B = 1000) # }
Run the code above in your browser using DataCamp Workspace