# hrSimNew: Calculate Tables 1-3 of Hardin and Rocke (2005) using the... In christopherggreen/HardinRockeExtensionSimulations: Replication and Extension of Hardin and Rocke (2005), Cerioli et al. (2009)

## Description

`hrSimNew` is used to calculate statistics like those presented in Tables 1–3 of Hardin and Rocke (2005), page 942, but with the modified asymptotic formulas calculated in Green and Martin (2014).

## Usage

 `1` ```hrSimNew(p, n, N, B = 10000, alpha = 0.05, mcd.alpha = max.bdp.mcd.alpha(n, p)) ```

## Arguments

 `p` The dimension of the data used in each simulated run. `n` The number of observations used in each simulated run. `N` The number of simulations to run. `B` 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. `alpha` The significance level to use for detecting outliers. `mcd.alpha` The fraction of the data to use in computing the MCD. Defaults to the maximum breakdown point fraction.

## Details

This is a work function designed for use in replicating Tables 1–3 of Hardin and Rocke (2005), page 942, but using the asymptotic method of Green and Martin (2014) instead of the Hardin-Rocke method. The Green and Martin method is more accurate for MCD fractions other than the maximum breakdown point one.

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

This function is nearly identical to `hrSim`, except that it uses different cutoff values.

## Value

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 Green and Martin (2014) (prefix is “CGASY”); and

3. the last three test against the cutoff predicted in Green and Martin (2014) (prefix is “GGPRED”).

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).

## Note

This function is deprecated; use `hrSimNewParallel` instead.

## Author(s)

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

## References

C. G. Green and R. Douglas Martin. An extension of a method of Hardin and Rocke, with an application to multivariate outlier detection via the IRMCD method of Cerioli. Working Paper, 2014. Available from http://students.washington.edu/cggreen/uwstat/papers/cerioli_extension.pdf

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

`covMcd`, `hrSimParallel`, `hrSim`, `hrSimNewParallel`
 ```1 2``` ``` require( CerioliOutlierDetection ) hrResults.p5.n50 <- hrSimNew(p=5,n=50 ,N=50,B=50) ```