jackknife
From resample v0.4
by Tim Hesterberg
One sample jackknife
Basic resampling. Supply the data and statistic to resample.
- Keywords
- nonparametric
Usage
jackknife(data, statistic, args.stat = NULL, label = NULL, statisticNames = NULL, trace = FALSE)
Arguments
- data
- vector, matrix, or data frame.
- statistic
-
a function, or expression (e.g.
mean(myData, trim = .2)
. - args.stat
-
a list of additional arguments to pass to
statistic
, if it is a function. - label
- used for labeling plots (in a future version).
- statisticNames
-
a character vector the same length as the vector returned by
statistic
. - trace
-
logical, if
TRUE
an indication of progress is printed.
Value
-
a list with class
- observed
- the value of the statistic for the original data.
- replicates
- a matrix with
R
rows andp
columns. - n
- number of observations in the original data, or vector of length 2 in two-sample problems.
- p
length(observed)
.- R
- number of replications.
- seed
- the value of the seed at the start of sampling.
- call
- the matched call.
- statistics
- a data frame with
p
rows, with columns"observed"
,"mean"
(the mean of the replicates), and other columns appropriate to resampling; e.g. the bootstrap objects have columns"SE"
and"Bias"
, while the permutation test objects have"Alternative"
and"PValue"
. There are functions for printing and plotting these objects,
in particular
"jackknife"
that inherits from "resample"
,
with components:
print
, plot
, hist
, qqnorm
,
quantile
.
Note
The current version only handles a single sample.
See Also
Examples
## Not run:
# # See full set of examples in resample-package
# data(Verizon)
# CLEC <- with(Verizon, Time[Group == "CLEC"])
# jackknife(CLEC, mean)
# ## End(Not run)
Community examples
huangminz@foxmail.com
at
Feb 16, 2020
resample
v0.4
library(bootstrap) library(dplyr) sample_n<-40 c<-slice(mydata,1:sample_n) k<-ncol(c) cov_temp<-matrix(0,k,k) for(i in c(1:sample_n)) { cov_temp=cov_temp+cov(c[-i,]) } jackknife(c,coveriance)