PreEst.2014Banerjee {CovTools} | R Documentation |
Bayesian Estimation of a Banded Precision Matrix (Banerjee 2014)
Description
PreEst.2014Banerjee
returns a Bayes estimator of the banded precision matrix using G-Wishart prior.
Stein’s loss or squared error loss function is used depending on the “loss” argument in the function.
The bandwidth is set at the mode of marginal posterior for the bandwidth parameter.
Usage
PreEst.2014Banerjee(
X,
upperK = floor(ncol(X)/2),
delta = 10,
logpi = function(k) { -k^4 },
loss = c("Stein", "Squared")
)
Arguments
X |
an |
upperK |
upper bound of bandwidth |
delta |
hyperparameter for G-Wishart prior. Default value is 10. It has to be larger than 2. |
logpi |
log of prior distribution for bandwidth |
loss |
type of loss; either |
Value
a named list containing:
- C
a
(p\times p)
MAP estimate for precision matrix.
References
Banerjee S, Ghosal S (2014). “Posterior convergence rates for estimating large precision matrices using graphical models.” Electronic Journal of Statistics, 8(2), 2111–2137. ISSN 1935-7524.
Examples
## generate data from multivariate normal with Identity precision.
pdim = 10
data = matrix(rnorm(50*pdim), ncol=pdim)
## compare different K
out1 <- PreEst.2014Banerjee(data, upperK=1)
out2 <- PreEst.2014Banerjee(data, upperK=3)
out3 <- PreEst.2014Banerjee(data, upperK=5)
## visualize
opar <- par(no.readonly=TRUE)
par(mfrow=c(2,2), pty="s")
image(diag(pdim)[,pdim:1],main="Original Precision")
image(out1$C[,pdim:1], main="banded1::upperK=1")
image(out2$C[,pdim:1], main="banded1::upperK=3")
image(out3$C[,pdim:1], main="banded1::upperK=5")
par(opar)