# covOGK: Orthogonalized Gnanadesikan-Kettenring (OGK) Covariance... In robustbase: Basic Robust Statistics

## Description

Computes the orthogonalized pairwise covariance matrix estimate described in in Maronna and Zamar (2002). The pairwise proposal goes back to Gnanadesikan and Kettenring (1972).

## Usage

 ```1 2 3 4 5 6``` ```covOGK(X, n.iter = 2, sigmamu, rcov = covGK, weight.fn = hard.rejection, keep.data = FALSE, ...) covGK (x, y, scalefn = scaleTau2, ...) s_mad(x, mu.too = FALSE, na.rm = FALSE) s_IQR(x, mu.too = FALSE, na.rm = FALSE) ```

## Arguments

 `X` data in something that can be coerced into a numeric matrix. `n.iter` number of orthogonalization iterations. Usually 1 or 2; values greater than 2 are unlikely to have any significant effect on the estimate (other than increasing the computing time). `sigmamu, scalefn` a function that computes univariate robust location and scale estimates. By default it should return a single numeric value containing the robust scale (standard deviation) estimate. When `mu.too` is true, `sigmamu()` should return a numeric vector of length 2 containing robust location and scale estimates. See `scaleTau2`, `s_Qn`, `s_Sn`, `s_mad` or `s_IQR` for examples to be used as `sigmamu` argument. `rcov` function that computes a robust covariance estimate between two vectors. The default, Gnanadesikan-Kettenring's `covGK`, is simply (s^2(X+Y) - s^2(X-Y))/4 where s() is the scale estimate `sigmamu()`. `weight.fn` a function of the robust distances and the number of variables p to compute the weights used in the reweighting step. `keep.data` logical indicating if the (untransformed) data matrix `X` should be kept as part of the result. `...` additional arguments; for `covOGK` to be passed to `sigmamu()` and `weight.fn()`; for `covGK` passed to `scalefn`.
 `x,y` numeric vectors of the same length, the covariance of which is sought in `covGK` (or the scale, in `s_mad` or `s_IQR`).
 `mu.too` logical indicating if both location and scale should be returned or just the scale (when `mu.too=FALSE` as by default). `na.rm` if `TRUE` then `NA` values are stripped from `x` before computation takes place.

## Details

Typical default values for the function arguments `sigmamu`, `rcov`, and `weight.fn`, are available as well, see the Examples below, but their names and calling sequences are still subject to discussion and may be changed in the future.

The current default, `weight.fn = hard.rejection` corresponds to the proposition in the litterature, but Martin Maechler strongly believes that the hard threshold currently in use is too arbitrary, and further that soft thresholding should be used instead, anyway.

## Value

`covOGK()` currently returns a list with components

 `center` robust location: numeric vector of length p. `cov` robust covariance matrix estimate: p x p matrix. `wcenter, wcov` re-weighted versions of `center` and `cov`. `weights` the robustness weights used. `distances` the mahalanobis distances computed using `center` and `cov`.

......
but note that this might be radically changed to returning an S4 classed object!

`covGK()` is a trivial 1-line function returning the covariance estimate

c^(x,y) = [s^(x+y)^2 - s^(x-y)^2]/4,

where s^(u) is the scale estimate of u specified by `scalefn`.

`s_mad()`, and `s_IQR()` return the scale estimates `mad` or `IQR` respectively, where the `s_*` functions return a length-2 vector (mu, sig) when `mu.too = TRUE`, see also `scaleTau2`.

## Author(s)

Kjell Konis [email protected], with modifications by Martin Maechler.

## References

Maronna, R.A. and Zamar, R.H. (2002) Robust estimates of location and dispersion of high-dimensional datasets; Technometrics 44(4), 307–317.

Gnanadesikan, R. and John R. Kettenring (1972) Robust estimates, residuals, and outlier detection with multiresponse data. Biometrics 28, 81–124.

`scaleTau2`, `covMcd`, `cov.rob`.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22``` ```data(hbk) hbk.x <- data.matrix(hbk[, 1:3]) cO1 <- covOGK(hbk.x, sigmamu = scaleTau2) cO2 <- covOGK(hbk.x, sigmamu = s_Qn) cO3 <- covOGK(hbk.x, sigmamu = s_Sn) cO4 <- covOGK(hbk.x, sigmamu = s_mad) cO5 <- covOGK(hbk.x, sigmamu = s_IQR) data(toxicity) cO1tox <- covOGK(toxicity, sigmamu = scaleTau2) cO2tox <- covOGK(toxicity, sigmamu = s_Qn) ## nice formatting of correlation matrices: as.dist(round(cov2cor(cO1tox\$cov), 2)) as.dist(round(cov2cor(cO2tox\$cov), 2)) ## "graphical" symnum(cov2cor(cO1tox\$cov)) symnum(cov2cor(cO2tox\$cov), legend=FALSE) ```

### Example output

```       1     2     3     4     5     6     7     8     9
2   0.70
3  -0.64 -0.43
4   0.05 -0.21  0.58
5  -0.14  0.02  0.51  0.30
6   0.73  0.61 -0.87 -0.58 -0.17
7   0.31  0.55 -0.26 -0.41  0.60  0.60
8  -0.12 -0.21 -0.45 -0.76 -0.02  0.50  0.43
9  -0.71 -0.51  0.31 -0.40  0.43 -0.19  0.31  0.66
10  0.17 -0.16 -0.08  0.22 -0.18  0.00 -0.29 -0.12 -0.25
1     2     3     4     5     6     7     8     9
2   0.91
3  -0.32 -0.17
4  -0.25 -0.05  0.64
5  -0.01  0.28  0.48  0.48
6   0.88  0.72 -0.50 -0.54 -0.08
7   0.78  0.78 -0.11 -0.06  0.36  0.77
8   0.32  0.13 -0.57 -0.84 -0.22  0.70  0.41
9  -0.28 -0.35 -0.11 -0.50  0.00  0.11  0.14  0.72
10  0.36  0.18 -0.25 -0.07 -0.06  0.41  0.43  0.24  0.09

[1,] 1
[2,] , 1
[3,] , . 1
[4,]     . 1
[5,]     . . 1
[6,] , , + .   1
[7,] . .   . , . 1
[8,]     . ,   . . 1
[9,] , . . . .   . , 1
[10,]                   1
attr(,"legend")
[1] 0 ' ' 0.3 '.' 0.6 ',' 0.8 '+' 0.9 '*' 0.95 'B' 1

[1,] 1
[2,] * 1
[3,] .   1
[4,]     , 1
[5,]     . . 1
[6,] + , . .   1
[7,] , ,     . , 1
[8,] .   . +   , . 1
[9,]   .   .       , 1
[10,] .         . .     1
```

robustbase documentation built on July 20, 2018, 1:03 a.m.