jackknife: Delete-d Jackknife for Estimates

View source: R/jackknife.R

jackknifeR Documentation

Delete-d Jackknife for Estimates

Description

This function creates jackknife samples from the data by sequentially removing d observations from the data, and calculates the estimates by the specified function and its bias, standard error, and confidence intervals.

Usage

jackknife(
  statistic,
  d = 1,
  data,
  conf = 0.95,
  numCores = detectCores(),
  weight = FALSE,
  hat_values = NULL,
  residuals = NULL,
  X = NULL,
  p = NULL
)

Arguments

statistic

a function returning a vector of estimates to be passed to jackknife

d

Number of observations to be deleted from data to make jackknife samples. The default is 1 (for delete-1 jackknife).

data

Data frame with dependent and independent independent variables specified in the formula

conf

Confidence level, a positive number < 1. The default is 0.95.

numCores

Number of processors to be used

weight

Logical, TRUE for weighted jackknife standard error of regression estimates. Default weight = FALSE

hat_values

Vector of hat values (leverages) from the model. Required if 'weight = TRUE

residuals

Vector of residuals from the model. Required if weight = TRUE.

X

Model matrix. Required if weight = TRUE.

p

Number of predictors in the model. Required if weight = TRUE.

Value

A list containing a summary data frame of jackknife estimates with bias, standard error. t-statistics, and confidence intervals, estimate for the original sample and a data frame with estimates for jackknife samples.

References

Quenouille, M. H. (1956). Notes on Bias in Estimation. Biometrika, 43(3/4), 353-360. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.2307/2332914")}

Tukey, J. W. (1958). Bias and Confidence in Not-quite Large Samples. Annals of Mathematical Statistics, 29(2), 614-623. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1214/aoms/1177706647")}

Shi, X. (1988). A note on the delete-d jackknife variance estimators. Statistics & Probability Letters, 6(5), 341-347. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1016/0167-7152(88)90011-9")}

See Also

jackknife.lm() which is used for jackknifing in linear regression.

Examples

library(future)
plan(multisession)  # Initialize once per session
# For linear regression coefficients
jk_results <- jackknife(
statistic = function(sub_data) coef(lm(mpg ~ wt + hp, data = sub_data)),
d = 2,
data = mtcars,
conf = 0.95, numCores = 2)
print(jk_results)

jackknifeR documentation built on June 8, 2025, 10:41 a.m.