ROBUST INFERENCE FOR DIFFERENCES OF VARIANCES
=============================================

Michael Wolf
University of Zurich
September 2026


This collection of R routines provides robust inference for differences
of variances. It supersedes all previous versions of these routines.

The routines are designed for inference on the difference between the
log variances of two return series. They do not provide inference for
an individual variance.


GETTING STARTED
===============

The file Variance.RData contains all routines as well as two example
datasets. To load everything into the R workspace, use

> load("Variance.RData")

The individual .R files containing the source code for all routines are
also included in the distribution. They are not needed if Variance.RData
has been loaded, but are provided for users who wish to inspect or modify
the code.


MAIN ROUTINES
=============

hac.variance
----------------------

Carries out HAC inference for the difference between two log variances.

The routine reports the estimated difference in log variances, HAC
standard errors, and corresponding two-sided p-values. Both the standard
HAC estimator and its prewhitened version are reported. The Parzen
kernel is used.

Example:

> hac.variance(ret.agg)


bootstrap.variance
------------------

Carries out studentized circular block bootstrap inference for the
difference between two log variances.

The user supplies the block size b and the number M of bootstrap
replications. The default null hypothesis is that the difference between
the two log variances is zero.

Example:

> bootstrap.variance(ret.agg, b = 6, M = 9999)

The routine returns the estimated difference in log variances and the
two-sided bootstrap p-value.

A data-dependent block size can be obtained using
block.size.calibrate.variance.


block.size.calibrate.variance
-----------------------------

Selects the block size for the circular block bootstrap using the
calibration procedure of Ledoit and Wolf (2011).

The default candidate block sizes are

    b.vec = c(1, 2, 4, 6, 8, 10)

the default number of bootstrap replications used for each test is

    M = 499

and the default number of calibration samples is

    K = 1000.

Example:

> block.size.calibrate.variance(ret.agg)

The routine reports the estimated rejection probability for each
candidate block size and the selected block size.

The calibration is computationally more demanding than the other
routines and may take several minutes. We recommend running this
function separately and then supplying the selected block size to
bootstrap.variance.

Users should inspect the estimated rejection probabilities rather than
rely mechanically on the selected block size. In particular, if the
selected block size is at the boundary of b.vec and the rejection
probabilities are still moving toward the nominal significance level,
the candidate set should be extended and the calibration rerun.


boot.stats.variance
-------------------

For a given circular block bootstrap sample and block size, computes

    Delta.hat.star    the bootstrap difference in sample log variances

and

    se.star           the corresponding bootstrap standard error.

This is primarily a supporting routine and is called internally by
bootstrap.variance.

The number of observations in the bootstrap sample must be a multiple
of the block size.

Users interested only in bootstrap inference for a single difference
of log variances do not need to call boot.stats.variance directly.


SUPPORTING ROUTINES
===================

The distribution contains a number of supporting routines used internally
for HAC estimation, prewhitening, circular and stationary block bootstrap
sampling, block-size calibration, and computation of differences in log
variances.

The source code for each routine is supplied in a separate .R file.

Users interested only in standard inference will normally need to call
only hac.inference.variance, bootstrap.variance, and, if desired,
block.size.calibrate.variance.

Users implementing their own bootstrap procedures may additionally find
boot.stats.variance useful.


IMPLEMENTATION
==============

The parameter of interest is

    Delta = log(variance 1) - log(variance 2).

Thus, the null hypothesis Delta = 0 is equivalent to equality of the
two variances.

The HAC routines use the Parzen kernel. Both standard and prewhitened
HAC inference are provided.

Bootstrap inference uses the studentized circular block bootstrap.

The block-size calibration uses the stationary bootstrap to generate
the calibration samples.

The current implementation uses vectorized R code where useful for
computational efficiency.


DATA
====

The input return matrix for the main inference routines must have two
columns, one for each return series. Thus, ret must be a T x 2 matrix
rather than a 2 x T matrix.

The dataset ret.agg contains the mutual-fund data used in the empirical
application of Ledoit and Wolf (2008).

The dataset ret.hedge contains the hedge-fund data used in the empirical
application of Ledoit and Wolf (2008).

Both datasets are included in Variance.RData and can be used as example
datasets for the variance-inference routines.


FILES
=====

Variance.RData contains all routines and the two example datasets.

In addition, the distribution contains one .R source file for each
routine. These source files are provided for transparency and for users
who wish to inspect or modify the implementation.

Loading Variance.RData is sufficient for normal use of the routines.


REFERENCES
==========

Ledoit, O. and Wolf, M. (2008).
Robust performance hypothesis testing with the Sharpe ratio.
Journal of Empirical Finance 15, 850-859.

Ledoit, O. and Wolf, M. (2011).
Robust performances hypothesis testing with the variance.
Wilmott Magazine, September, 86-89.

