Learn R Programming

spaceExt (version 1.0)

space.miss: Sparse Covariance Selection by SPACE with EM

Description

A function to estimate partial correlations using SPACE method with EM, missing data is allowed

Usage

space.miss(Y.m,lam1, lam2=0, sig=NULL, weight=NULL,iter=2, emIter=5,n_iter=1000,t0=0,r=0)

Arguments

Y.m
numeric matrix. Columns are for variables and rows are for samples. It's recommended to first standardize each column to have mean 0 and $l_2$ norm 1.
lam1
numeric value. This is the $l_1$ norm penalty parameter. If the columns of Y.m have norm one, then the suggested range of lam1 is $O(n^{3/2}\Phi^{-1}(1-\alpha/(2p^2)))$ for small $\alpha$ such as 0.1.
lam2
numeric value. If not specified, lasso regression is used in the Joint Sparse Regression Model (JSRM). Otherwise, elastic net regression is used in JSRM and lam2 serves as the $l_2$ norm penalty parameter.
sig
numeric vector. Its length should be the same as the number of columns of Y.m. It is the vector of $\sigma^{ii}$ (the diagonal of the inverse covariance matrix). If not specified, $\sigma^{ii}$ will be estimated during the model fitting with initial valu
weight
numeric value or vector. It specifies the weights or the type of weights used for each regression in JSRM. The default value is NULL, which means all regressions will be weighted equally in the joint model. If weight=1, residue variances will be used f
iter
integer. It is the total number of interactions in JSRM for estimating $\sigma^{ii}$ and partial correlations. When sig=NULL and/or weight=NULL or 2, iter should be at least 2.
emIter
integer. the maximum number of EM iteration allowed
n_iter
integer. the maximum number of interations in JSRM.
t0
integer. $1
r
positive value. local smoothing parameter. If r=0, then no smoothing is incorporated.

Value

  • a list of following comopnents.
  • Y.imputedThe sample matrix Y with missing data imputed by EM
  • ParCorthe estimated partial correlation matrix.
  • sig.fitnumeric vector of the estimated diagonal $\sigma^{ii}$.
  • bicBIC for the current estimate.

Details

space.miss Based on the work of J. Peng, et al(2007), this function allows computing with missing data by implementing EM algorithm. $$\frac{1}{2}\sum_{t=1}^n K(r*|t-t_0|) [\sum_{i=1}^p w_i(y_{it}-\sum_{j\neq i}\sqrt{\frac{\sigma_{jj}}{\sigma_{ii}}}\rho_{ij}y_{jt})^2 ] +\lambda\sum_{i

References

He, S.Y., Wang, X., and Yuan, W.(2012), Discovering Co-movement Structure of Chinese Stock Market by SPACE method with EM. J. Peng, P. Wang, N. Zhou, J. Zhu (2007), Partial Correlation Estimation by Joint Sparse Regression Model. Meinshausen, N., and Buhlmann, P. (2006), High Dimensional Graphs and Variable Selection with the Lasso, Annals of Statistics, 34, 1436-1462.

Examples

Run this code
data(finStocksCn)  ##data of finance sector of Chinese Stock Market, from January 4th, 2011 to July 26th, 2011
finStocksCn$names ##stock names
y.m<-scale(finStocksCn$returns)
n=nrow(y.m)
p=ncol(y.m)
alpha=0.1
l1=1/sqrt(n)*qnorm(1-alpha/(2*p^2))
res=space.miss(Y.m=y.m,lam1=l1*25,emIter=25,iter=2,weight=2)
res$bic  ##bic returned

Run the code above in your browser using DataLab