Title: | Covariance and Inverse Covariance Matrix Estimation Using Joint Penalty |
---|---|
Description: | A Joint PENalty Estimation of Covariance and Inverse Covariance Matrices. |
Authors: | Ashwini Maurya |
Maintainer: | Ashwini Maurya <[email protected]> |
License: | GPL-2 |
Version: | 1.0 |
Built: | 2024-11-20 06:23:17 UTC |
Source: | CRAN |
A Joint PENalty Estimation of Covariance and Inverse Covariance Matrices.
The DESCRIPTION file:
Package: | JPEN |
Type: | Package |
Title: | Covariance and Inverse Covariance Matrix Estimation Using Joint Penalty |
Version: | 1.0 |
Date: | 2015-08-20 |
Author: | Ashwini Maurya |
Maintainer: | Ashwini Maurya <[email protected]> |
Description: | A Joint PENalty Estimation of Covariance and Inverse Covariance Matrices. |
Depends: | mvtnorm(>= 1.0-2), stats(>= 2.15.0), |
License: | GPL-2 |
NeedsCompilation: | no |
Packaged: | 2015-09-06 23:34:02 UTC; STT User |
Repository: | CRAN |
Date/Publication: | 2015-09-16 10:05:02 |
Index of help topics:
JPEN-package Covariance and Inverse Covariance Matrix Estimation Using Joint Penalty f.K.fold Subset the data into K fold, training and test data. jpen JPEN Estimate of covariance matrix jpen.inv JPEN estimate of inverse cov matrix jpen.inv.tune Tuning parameter Selection for inverse covariance matrix estimation based on minimization of Gaussian log-likelihood. jpen.tune Tuning parameter selection based on minimization of 5 fold mean square error. lamvec returns a vector of values of lambda for given value of gamma tr Trace of matrix
Ashwini Maurya, Email: [email protected]. Ashwini Maurya Maintainer: Ashwini Maurya <[email protected]>
A Well Conditioned and Sparse Estimate of Covariance and Inverse Covariance Matrix Using Joint Penalty. Submitted. http://arxiv.org/pdf/1412.7907v2.pdf
jpen,jpen.inv
K-fold subsetting.
f.K.fold(Nobs, K = 5)
f.K.fold(Nobs, K = 5)
Nobs |
n is number of observations |
K |
K is number of folds, typically 5 fold. |
K-fold subset of observations into training and test data.
Returns the index for K-fold training and test data subsets.
Ashwini Maurya, Email: [email protected]
A Well Conditioned and Sparse Estimate of Covariance and Inverse Covariance Matrix Using Joint Penalty. Submitted. http://arxiv.org/pdf/1412.7907v2.pdf
n=100;K=5;cv=f.K.fold(n,K);
n=100;K=5;cv=f.K.fold(n,K);
Estimate of covariance Matrix using Joint Penalty Method
jpen(S, gam, lam=NULL)
jpen(S, gam, lam=NULL)
S |
Sample covariance matrix. |
gam |
Tuning parameter gamma. gam is non-negative. |
lam |
Tuning parameter lambda. lam is non-negative. |
This function returns an estimate of covariance matrix using Joint Penalty method.
Estimate of Covariance Matrix.
Ashwini Maurya, Email: [email protected]
A Well Conditioned and Sparse Estimate of Covariance and Inverse Covariance Matrix Using Joint Penalty. Submitted. http://arxiv.org/pdf/1412.7907v2.pdf
jpen.tune, jpen.inv
p=10;n=100; Sig=diag(p); y=rmvnorm(n,mean=rep(0,p),sigma=Sig); gam=1.0;S=var(y); lam=2/p; Sighat=jpen(S,gam,lam);
p=10;n=100; Sig=diag(p); y=rmvnorm(n,mean=rep(0,p),sigma=Sig); gam=1.0;S=var(y); lam=2/p; Sighat=jpen(S,gam,lam);
A well conditioned and sparse estimate of inverse covariance matrix using Joint Penalty
jpen.inv(S, gam, lam=NULL)
jpen.inv(S, gam, lam=NULL)
S |
Sample cov matrix or a positive definite estimate based on covariance matrix. |
gam |
gam is tuning parameter for eigenvalues shrinkage. |
lam |
lam is tuning parameter for sparsity. |
Estimates a well conditioned and sparse inverse covariance matrix using Joint Penalty. If input matrix is singular or nearly singular, a JPEN estimate of covariance matrix is used in place of S.
Returns a well conditioned and positive inverse covariance matrix.
Ashwini Maurya, Email: [email protected].
A Well Conditioned and Sparse Estimate of Covariance and Inverse Covariance Matrix Using Joint Penalty. Submitted. http://arxiv.org/pdf/1412.7907v2.pdf
jpen,jpen.tune,jpen.inv.tune
p=10;n=100; Sig=diag(p); y=rmvnorm(n,mean=rep(0,p),sigma=Sig); S=var(y); gam=1.0; lam=2*max(abs(S[col(S)!=row(S)]))/p; Omghat=jpen.inv(var(y),gam,lam);
p=10;n=100; Sig=diag(p); y=rmvnorm(n,mean=rep(0,p),sigma=Sig); S=var(y); gam=1.0; lam=2*max(abs(S[col(S)!=row(S)]))/p; Omghat=jpen.inv(var(y),gam,lam);
Returns optimal values of tuning parameters lambda and gamma
jpen.inv.tune(Ytr, gama, lambda=NULL)
jpen.inv.tune(Ytr, gama, lambda=NULL)
Ytr |
Ytr is matrix of observations. |
gama |
A vector of gamma values. |
lambda |
Optional vector of values of lambda. If optional, the algorithm automatically calculates 10 values of lambda for each gamma and finds the optimal values of (lambda,gamma) that minimizes the negative of Gaussian likelihood function using K-fold cross validation. |
Returns the value of optimal tuning parameters. The function uses K-fold cross validation to select the best tuning parameter from among a set of of values of lambda and gamma.
Returns the optimal values of lambda and gamma.
Ashwini Maurya, Email: [email protected].
A Well Conditioned and Sparse Estimate of Covariance and Inverse Covariance Matrix Using Joint Penalty. Submitted. http://arxiv.org/pdf/1412.7907v2.pdf
jpen
p=10;n=100; Sig=diag(p); y=rmvnorm(n,mean=rep(0,p),sigma=Sig); gama=c(0.5,1.0); opt=jpen.inv.tune(var(y),gama);
p=10;n=100; Sig=diag(p); y=rmvnorm(n,mean=rep(0,p),sigma=Sig); gama=c(0.5,1.0); opt=jpen.inv.tune(var(y),gama);
Returns optimal values of tuning parameters lambda and gamma which minimizes the K-fold crossvalidation error on
jpen.tune(Ytr, gama, lambda=NULL)
jpen.tune(Ytr, gama, lambda=NULL)
Ytr |
Ytr is matrix of observations. |
gama |
gama is vector of gamma values. gamma is non-negative. |
lambda |
lambda is vector of lambda values. lambda is non-negative. |
Returns the value of optimal tuning parameters. The function uses K-fold cross validation to select the best tuning parameter from among a set of of values of lambda and gamma.
Returns the optimal values of lambda and gamma.
Ashwini Maurya, Email: [email protected].
A Well Conditioned and Sparse Estimate of Covariance and Inverse Covariance Matrix Using Joint Penalty. Submitted. http://arxiv.org/pdf/1412.7907v2.pdf
jpen
p=10;n=100; Sig=diag(p); y=rmvnorm(n,mean=rep(0,p),sigma=Sig); gama=c(0.5,1.0); opt=jpen.tune(Ytr=y,gama);
p=10;n=100; Sig=diag(p); y=rmvnorm(n,mean=rep(0,p),sigma=Sig); gama=c(0.5,1.0); opt=jpen.tune(Ytr=y,gama);
returns 10 values of lambda for each gamma.
lamvec(c, gam, p)
lamvec(c, gam, p)
c |
c is absolute maximum of off-diagonal entries of sample covariance matrix. |
gam |
gamma is a non-negative constant. |
p |
p is number of rows/columns of matrix. |
The lamvec function retuns a 10 values of lambda for each value of gamma. A larger value of lambda yields sparse estimate but need not be positive definite, however at least one combination of (lambda, gamma) will yield a positive definite solution. If two different combination of (lambda, gamma) yeilds same cross validation error, a larger values of lambda will be selected which results in more sparse solution.
A vector of values of lambda for each combination of gama. By choosing c as the maximum of off-diagonal elements of sample covariance matrix, the largest value of lambda yields an estimate which diagonal matrix with elements proportional to the diagonal elements of sample covariance matrix.
Ashwini Maurya, Email: [email protected]
A Well Conditioned and Sparse Estimate of Covariance and Inverse Covariance Matrix Using Joint Penalty. Submitted. http://arxiv.org/pdf/1412.7907v2.pdf
jpen, jpen.inv, jpen.tune, jpen.tune.inv
p=10;n=100;Sig=diag(p); y=rmvnorm(n,mean=rep(0,p),sigma=Sig); gam=c(0.5); S=var(y); c=max(abs(S[row(S)!=col(S)])); lambda=lamvec(c,gam,p);
p=10;n=100;Sig=diag(p); y=rmvnorm(n,mean=rep(0,p),sigma=Sig); gam=c(0.5); S=var(y); c=max(abs(S[row(S)!=col(S)])); lambda=lamvec(c,gam,p);
Returns the trace of a matrix
tr(A)
tr(A)
A |
A is the input matrix. |
Returns the trace (sum of diagonal elements )of input matrix).
Trace of input matrix.
Ashwini Maurya, Email: [email protected]
A Well Conditioned and Sparse Estimate of Covariance and Inverse Covariance Matrix Using Joint Penalty. Submitted. http://arxiv.org/pdf/1412.7907v2.pdf
p=10;n=100;Sig=diag(p); y=rmvnorm(n,mean=rep(0,p),sigma=Sig); S=var(y); tr(S);
p=10;n=100;Sig=diag(p); y=rmvnorm(n,mean=rep(0,p),sigma=Sig); S=var(y); tr(S);