haff_cov: Stein/Haff's covariance estimator

Description Usage Arguments Value References Examples

View source: R/stcov.R

Description

Stein/Haff's covariance estimator

Usage

1
haff_cov(S, n)

Arguments

S

Sample covariance matrix

n

Number of observations

Value

Estimated covariance matrix

References

Haff, L. R. "The Variational Form of Certain Bayes Estimators." The Annals of Statistics 19, no. 3 (1991): 1163-1190.

Lin, S.P. and Perlman, M.D.. "A Monte Carlo comparison of four estimators of a covariance matrix." Multivariate Analysis 6 (1985): 411-429.

Stein, C. "Estimation of a covariance matrix". Rietz Lecture (1975).

Examples

1
2
3
4
p <- 5
n <- 10
S <- rWishart(1, n, diag(p))[,,1]
haff_cov(S, n)

Example output

              [,1]          [,2]          [,3]          [,4]          [,5]
[1,]  7.361348e+00 -2.220446e-16 -4.440892e-16  6.661338e-16 -2.220446e-16
[2,] -4.440892e-16  7.361348e+00 -2.664535e-15  8.881784e-16 -1.776357e-15
[3,]  4.440892e-16 -2.664535e-15  7.361348e+00 -5.551115e-16  4.440892e-16
[4,]  4.440892e-16  1.110223e-15 -4.440892e-16  7.361348e+00  8.326673e-16
[5,] -2.220446e-16 -1.998401e-15  4.440892e-16  4.440892e-16  7.361348e+00

stcov documentation built on May 1, 2019, 6:39 p.m.

Related to haff_cov in stcov...