bootstrap | R Documentation |
The function serves as a simplified alternative to the function boot
from the library boot
.
bootstrap(data, statistic, R = 1000, prob = NULL, matrix = FALSE)
data |
Raw data to be bootstrapped. A vector or quantitative data or a matrix if |
statistic |
A function whose output is a statistic (e.g. a sample mean). The function must have only one argument, a call to data. |
R |
The number of bootstrap iterations. |
prob |
A vector of probability weights for paramteric bootstrapping. |
matrix |
A logical statement. If |
With bootstrapping we sample with replacement from a dataset of size n with n samples R
times. At each of the R
iterations a statistical summary can be created resulting in a bootstrap distribution of statistics.
Returns a list. The utility function asbio:::print.bootstrap
returns summary output. Invisible items include the resampling distribution of the statistic, the data, the statistic, and the bootstrap samples.
Ken Aho
Manly, B. F. J. (1997) Randomization and Monte Carlo Methods in Biology, 2nd edition. Chapman and Hall, London.
boot
, ci.boot
data(vs)
# A partial set of observations from a single plot for a Scandinavian
# moss/vascular plant/lichen survey.
site18<-t(vs[1,])
#Shannon-Weiner diversity
SW<-function(data){
d<-data[data!=0]
p<-d/sum(d)
-1*sum(p*log(p))
}
bootstrap(site18[,1],SW,R=1000,matrix=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.