Learn R Programming

PDSCE (version 1.2.1)

pdsoft: A permutation invariant positive definite and sparse covariance matrix estimate

Description

Computes the sparse and positive definite covariance matrix estimator proposed by Rothman (2012).

Usage

pdsoft(s, lam, tau = 1e-04, init = c("soft", "diag", "dense", "user"), 
       s0 = NULL, i0 = NULL, standard = TRUE, tolin = 1e-08, 
       tolout = 1e-08, maxitin = 10000, maxitout = 1000, quiet = TRUE)

Arguments

s

A realization of the \(p\) by \(p\) sample covariance matrix. More generally, any symmetric \(p\) by \(p\) matrix with positive diagonal entries.

lam

The tuning parameter \(\lambda\) on the penalty \(\lambda \sum_{i\neq j} |\sigma_{ij}|\). Could be either a scalar or a \(p\) by \(p\) symmetric matrix with an irrelevant diagonal. When a matrix is used, the penalty has the form \(\sum_{i\neq j} \lambda_{ij} |\sigma_{ij}|\).

tau

The logarithmic barrier parameter. The default is tau=1e-4, which works well when standard=TRUE.

init

The type of initialization. The default option init="soft" uses a positive definite version of the soft thresholded covariance or correlation estimate, depending on standard. The second option init="diag" uses diagonal starting values. The third option init="dense" uses the closed-form solution when lam=0. The fourth option init="user" allows the user to specify the starting point (one must then specify s0 and i0, ensuring that i0 is positive definite).

s0

Optional user supplied starting point for \(\Sigma^{(0)}\); see Rothman (2012)

i0

Optional user supplied starting point for \(\Omega^{(0)}\); see Rothman (2012)

standard

Logical: standard=TRUE first computes the observed sample correlation matrix from s, then computes the sparse correlation matrix estimate, and finally rescales to return the sparse covariance matrix estimate. The strongly recommended default is standard=TRUE.

tolin

Convergence tolerance for the inner loop of the algorithm that solves the lasso regression.

tolout

Convergence tolerance for the outer loop of the algorithm.

maxitin

Maximum number of inner-loop iterations allowed

maxitout

Maximum number of outer-loop iterations allowed

quiet

Logical: quiet=TRUE suppresses the printing of progress updates.

Value

A list with

sigma

covariance estimate

omega

inverse covariance estimate

theta

correlation matrix estimate, will be NULL if standard=FALSE

theta.inv

inverse correlation matrix estimate, will be NULL if standard=FALSE

Details

See Rothman (2012) for the objective function and more information.

References

Rothman, A. J. (2012). Positive definite estimators of large covariance matrices. Biometrika 99(3): 733-740

See Also

pdsoft.cv

Examples

Run this code
# NOT RUN {
set.seed(1)
n=50
p=20
true.cov=diag(p)
true.cov[cbind(1:(p-1), 2:p)]=0.4
true.cov[cbind(2:p, 1:(p-1))]=0.4
eo=eigen(true.cov, symmetric=TRUE)
z=matrix(rnorm(n*p), nrow=n, ncol=p)
x=z%*% tcrossprod(eo$vec*rep(eo$val^(0.5), each=p),eo$vec)
s=cov(x)*(n-1)/n
output=pdsoft(s=s, lam=0.3)
output$sigma
# }

Run the code above in your browser using DataLab