8.5 The Jackknife
Let θ denote a scalar parameter of interest. It could be a scalar parameter of the GWN model (e.g. μ or σ) or it could be a scalar function of the parameters of the GWN model (e.g. VaR or SR). Let ˆθ denote the plug-in estimator of θ. The goal is to compute a numerical estimated standard error for ˆθ, ^se(ˆθ), using the jackknife resampling method.
The jackknife resampling method utilizes T resamples of the original data {Rt}Tt=1. The resamples are created by leaving out a single observation. For example, the first jackknife resample leaves out the first observation and is given by {Rt}Tt=2. This sample has T−1 observations. In general, the tth jackknife resample leaves out the tth return Rt for t≤T. Now, on each of the t=1,…,T jackknife resamples you compute an estimate of θ. Denote this jackknife estimate ˆθ−t to indicate that θ is estimated using the resample that omits observation t. The estimator ˆθ−t is called the leave-one-out estimator of θ. Computing ˆθ−t for t=1,…,T gives T leave-one-out estimators {ˆθ−t}Tt=1.
The jackknife estimator of ^se(ˆθ) is the scaled standard deviation of {ˆθ−t}Tt=1:
^sejack(ˆθ)=√T−1TT∑t=1(ˆθ−t−ˉθ)2,
where ˉθ=T−1∑Tt=1ˆθ−t is the sample mean of {ˆθ−t}Tt=1. The estimator (8.10) is easy to compute and does not require any analytic calculations from the asymptotic distribution of ˆθ.
The intuition for the jackknife standard error formula can be illustrated by considering the jackknife standard error estimate for the sample mean ˆθ=ˆμ. We know that the analytic estimated squared standard error for ˆμ is
^se(ˆμ)2=ˆσ2T=1T1T−1T∑t=1(Rt−ˆμ)2.
Now consider the jackknife squared standard error for ˆμ:
^sejack(ˆμ)2=T−1TT∑t=1(ˆμ−t−ˉμ)2,
where ˉμ=T−1∑Tt=1ˆμ−t. Here, we will show that ^se(ˆμ)2=^sejack(ˆμ)2.
First, note that
ˆμ−t=1T−1∑j≠tRj=1T−1(T∑j=1Rj−Rt)=1T−1(Tˆμ−Rt)=TT−1ˆμ−1T−1Rt.
Next, plugging in the above to the definition of ˉμ we get
ˉμ=1TT∑j=1ˆμ−t=1TT∑t=1(TT−1ˆμ−1T−1Rt)=1T−1T∑t=1ˆμ−1T1T−1T∑t=1Rt=TT−1ˆμ−1T−1ˆμ=ˆμ(TT−1−1T−1)=ˆμ.
Hence, the sample mean of ˆμ−t is ˆμ. Then we can write
ˆμ−t−ˉμ=ˆμ−t−ˆμ=TT−1ˆμ−1T−1Rt−ˆμ=TT−1ˆμ−1T−1Rt−T−1T−1ˆμ=1T−1ˆμ−1T−1Rt=1T−1(ˆμ−Rt).
Using the above we can write
^sejack(ˆμ)2=T−1TT∑t=1(ˆμ−t−ˉμ)2=T−1T(1T−1)2T∑t=1(ˆμ−Rt)2=1T1T−1T∑t=1(ˆμ−Rt)2=1Tˆσ2=^se(ˆμ)2.
We can compute the leave-one-out estimates {ˆμ−t}Tt=1 using a simple for
loop as follows:
length(msftRetS)
n.obs = rep(0, n.obs)
muhat.loo =for(i in 1:n.obs) {
mean(msftRetS[-i])
muhat.loo[i] = }
In the above loop, msftRetS[-i]
extracts all observations except observation i. The mean of the leave-one-out estimates is
mean(muhat.loo)
## [1] 0.00915
which is the sample mean of msftRetS
. It is informative to plot a histogram of the leave-one-out estimates:

Figure 8.1: Histogram of leave-one-out estimator of μ for Microsoft.
The white dotted line is at the point ˆμ=0.00915. The jackknife estimated standard error is the scaled standard deviation of the T ˆμ−t values:41
sqrt(((n.obs - 1)^2)/n.obs)*sd(muhat.loo)
se.jack.muhat = se.jack.muhat
## [1] 0.00774
This value is exactly the same as the analytic standard error:
se.muhatS
## [1] 0.00774
You can also compute jackknife estimated standard errors using the bootstrap function jackknife
:
library(bootstrap)
jackknife(coredata(msftRetS), mean)
muhat.jack =names(muhat.jack)
## [1] "jack.se" "jack.bias" "jack.values" "call"
By default, jackknife()
takes as input a vector of data and the name of an R function and returns a list with components related to the jackknife procedure. The component jack.values
contains the leave-one-out estimators, and the component jack.se
gives you the jackknife estimated standard error:
$jack.se muhat.jack
## [1] 0.00774
◼
The fact that the jackknife standard error estimate for ˆμ equals the analytic standard error is main justification for using the jackknife to compute standard errors. For estimated parameters other than ˆμ and general estimated functions the jackknife standard errors are often numerically very close to the delta method standard errors. The following example illustrates this point for the example functions (8.1) - (8.4).
Here, we use the bootstrap function jackknife()
to compute jackknife estimated standard errors for the plug-in estimates of the example functions (8.1) - (8.4) and we compare the jackknife standard errors with the delta method standard errors. To use jackknife()
with user-defined functions involving multiple parameters you must create the function such that the first input is an integer vector of index observations and the second input is the data. For example, a function for computing (8.1) to be passed to jackknife()
is:
function(x, xdata) {
theta.f1 = mean(xdata[x, ])
mu.hat = sd(xdata[x, ])
sigma.hat = mu.hat + sigma.hat*qnorm(0.05)
fun.hat =
fun.hat }
To compute the jackknife estimated standard errors for the estimate of (8.1) use:
jackknife(1:n.obs, theta=theta.f1, coredata(msftRetS))
f1.jack = cbind(f1.jack$jack.se, dm1$SE)
ans =colnames(ans) = c("Jackknife", "Delta Method")
rownames(ans) = "f1"
ans
## Jackknife Delta Method
## f1 0.0133 0.0119
Here, we see that the estimated jackknife standard error for f1(ˆθ) is very close to the delta method standard error computed earlier.
To compute the jackknife estimated standard error for f2(ˆθ) use:
function(x, xdata, W0) {
theta.f2 = mean(xdata[x, ])
mu.hat = sd(xdata[x, ])
sigma.hat = -W0*(mu.hat + sigma.hat*qnorm(0.05))
fun.hat =
fun.hat
} jackknife(1:n.obs, theta=theta.f2, coredata(msftRetS), W0)
f2.jack = cbind(f2.jack$jack.se, dm2$SE)
ans =colnames(ans) = c("Jackknife", "Delta Method")
rownames(ans) = "f2"
ans
## Jackknife Delta Method
## f2 1329 1187
Again, the jackknife standard error is close to the delta method standard error.
To compute the jackknife estimated standard error for f3(ˆθ) use:
function(x, xdata, W0) {
theta.f3 = mean(xdata[x, ])
mu.hat = sd(xdata[x, ])
sigma.hat = -W0*(exp(mu.hat + sigma.hat*qnorm(0.05)) - 1)
fun.hat =
fun.hat
} jackknife(1:n.obs, theta=theta.f3, coredata(msftRetC), W0)
f3.jack = cbind(f3.jack$jack.se, dm3$SE)
ans =colnames(ans) = c("Jackknife", "Delta Method")
rownames(ans) = "f3"
ans
## Jackknife Delta Method
## f3 1315 998
For log-normal VaR, the jackknife standard error is a bit larger than the delta method standard error.
Finally, to compute the jacknife estimated standard for the Sharpe ratio use:
function(x, xdata, r.f) {
theta.f4 = mean(xdata[x, ])
mu.hat = sd(xdata[x, ])
sigma.hat = (mu.hat-r.f)/sigma.hat
fun.hat =
fun.hat
} jackknife(1:n.obs, theta=theta.f4, coredata(msftRetS), r.f)
f4.jack = cbind(f4.jack$jack.se, dm4$SE)
ans =colnames(ans) = c("Jackknife", "Delta Method")
rownames(ans) = "f4"
ans
## Jackknife Delta Method
## f4 0.076 0.0763
Here, the jackknife and delta method standard errors are very close.
◼
8.5.1 The jackknife for vector-valued estimates
The jackknife can also be used to compute an estimated variance matrix of a vector-valued estimate of parameters. Let θ denote a k×1 vector of GWN model parameters (e.g. θ=(μ,σ)′), and let ˆθ denote the plug-in estimate of θ. Let ˆθ−t denote the leave-one-out estimate of θ, and ˉθ=T−1∑Tt=1ˆθ−t. Then the jackknife estimate of the k×k variance matrix ^var(ˆθ) is the scaled sample covariance of {ˆθ−t}Tt=1:
^varjack(ˆθ)=T−1TT∑t=1(ˆθ−t−ˉθ)(ˆθ−t−ˉθ)′.
The jackknife estimated standard errors for the elements of ˆθ are given by the square root of the diagonal elements of ^varjack(ˆθ).
The same principle works for computing the estimated variance matrix of a vector of functions of GWN model parameters. Let f:Rk→Rl with l≤k and define η=f(θ) denote a l×1 vector of functions of GWN model parameters. Let ˆη=f(ˆθ) denote the plug-in estimator of η. Let ˆη−t denote the leave-one-out estimate of η, and ˉη=T−1∑Tt=1ˆη−t. Then the jackknife estimate of the l×l variance matrix ^var(ˆη) is the scaled sample covariance of {ˆη−t}Tt=1:
^varjack(ˆη)=T−1TT∑t=1(ˆη−t−ˉη)(ˆη−t−ˉη)′.
The bootstrap function jackknife()
function only works for scalar-valued parameter estimates, so we have to compute the jackknife variance estimate by hand using a for
loop. The R code is:
length(msftRetS)
n.obs = rep(0, n.obs)
muhat.loo = rep(0, n.obs)
sigmahat.loo =for(i in 1:n.obs) {
mean(msftRetS[-i])
muhat.loo[i] = sd(msftRetS[-i])
sigmahat.loo[i] =
} cbind(muhat.loo, sigmahat.loo)
thetahat.loo =colnames(thetahat.loo) = c("mu", "sigma")
(((n.obs-1)^2)/n.obs)*var(thetahat.loo)
varhat.jack = varhat.jack
## mu sigma
## mu 5.99e-05 1.49e-05
## sigma 1.49e-05 6.12e-05
The jackknife variance estimate is somewhat close to the analytic estimate:
var.thetahatS
## mu sigma
## mu 5.99e-05 0.00e+00
## sigma 0.00e+00 2.99e-05
Since the first element of ˆθ is ˆμ, the (1,1) elements of the two variance matrix estimates match exactly. However, the varhat.jack
has non-zero off diagonal elements and the (2,2) element corresponding to ˆσ is considerably bigger than (2,2) element of the analytic estimate. Converting var.thetahatS
to an estimated correlation matrix gives:
cov2cor(varhat.jack)
## mu sigma
## mu 1.000 0.246
## sigma 0.246 1.000
Here, we see that the jackknife shows a small positive correlation between ˆμ and ˆσ whereas the analytic matrix shows a zero correlation.
◼
8.5.2 Pros and Cons of the Jackknife
The jackknife gets its name because it is a useful statistical device.42 The main advantages (pros) of the jacknife are:
It is a good “quick and dirty” method for computing numerical estimated standard errors of estimates that does not rely on asymptotic approximations.
The jackknife estimated standard errors are often close to the delta method standard errors.
This jackknife, however, has some limitations (cons). The main limitations are:
It can be computationally burdensome for very large samples (e.g., if used with ultra high frequency data).
It does not work well for non-smooth functions such as empirical quantiles.
It is not well suited for computing confidence intervals.
It is not as accurate as the bootstrap.