hrSim: Replicate Tables 1-3 of Hardin and Rocke (2005)

Description Usage Arguments Details Value Note Author(s) References See Also Examples


hrSim is used to replicate Tables 1–3 of Hardin and Rocke (2005), page 942.


hrSim(p, n, N, B = 10000, alpha = 0.05, mcd.alpha =, p))



The dimension of the data used in each simulated run.


The number of observations used in each simulated run.


The number of simulations to run.


The batch/block size: the number of simulations to run in each block. This is useful when running very large simulation runs (N very large) where memory is a concern.


The significance level to use for detecting outliers.


The fraction of the data to use in computing the MCD. Defaults to the maximum breakdown point fraction.


This is a work function designed for use in replicating Tables 1–3 of Hardin and Rocke (2005), page 942.

Internally the simulation function does B runs at a time. Set B smaller if your machine has less memory.


The function returns a matrix with N rows, one for each simulation, and at present, 9 columns: each column reports the fraction of observations in a simulation run that exceeded a given threshold (i.e., were flagged as outliers).

  1. The first three test Mahalanobis distances (MD) against a chi-squared quantile (prefix is “CHI2”);

  2. the next three test MDs against the asympotic cutoff used in Hardin and Rocke (2005) (prefix is “HRASY”); and

  3. the last three test against the cutoff predicted in Hardin and Rocke (2005) (prefix is “HRPRED”).

Within each group of three, the first entry (suffix “RAW”) uses (raw) MDs without the consistency correction or the small sample correction; the second entry (suffix “CON”) uses (raw) MDs without the small sample correction; and the third entry (suffix “SM”) uses the (raw) MDs with both correction factors. (It was not clear to the package author whether Hardin and Rocke (2005) used these correction factors in their calculations; so all variants were calculated and examined. Empirically, it seems the “CON” approach is the best match for their results.)

Look at the column means of the resulting matrix to see the average fraction of outliers detected (which is an estimate of the Type 1 error rate of the procedure, since the simulated data had no outliers).


This function is deprecated; use hrSimParallel instead.


Written and maintained by Christopher G. Green <[email protected]>


J. Hardin and D. M. Rocke. The distribution of robust distances. Journal of Computational and Graphical Statistics, 14:928-946, 2005.

See Also

covMcd, hrSimParallel, hrSimNew, hrSimNewParallel


  require( CerioliOutlierDetection )
  hrResults.p5.n50   <- hrSim(p=5,n=50  ,N=50,B=50)

christopherggreen/HardinRockeExtensionSimulations documentation built on May 13, 2019, 7:04 p.m.