# Sparse Covariance Selection by SPACE with EM

### Description

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

### Usage

1 | ```
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 |

`lam1` |
numeric value. This is the |

`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 |

`sig` |
numeric vector. Its length should be the same as the number of columns of Y.m. It is the vector of |

`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 for weights. If weight=2, the estimated degree of each variable will be used for weights. Otherwise, it should be a positive numeric vector, whose length is equal to the number of columns of Y.m |

`iter` |
integer. It is the total number of interactions in JSRM for estimating |

`emIter` |
integer. the maximum number of EM iteration allowed |

`n_iter` |
integer. the maximum number of interations in JSRM. |

`t0` |
integer. |

`r` |
positive value. local smoothing parameter. If r=0, then no smoothing is incorporated. |

### 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}∑_{t=1}^n K(r*|t-t_0|)
[∑_{i=1}^p w_i(y_{it}-∑_{j\neq i}√{\frac{σ_{jj}}{σ_{ii}}}ρ_{ij}y_{jt})^2 ]
+λ∑_{i<j} |ρ_ij|
*

where *K(\cdot)* is the smoothing kernal, *K(x)=\exp(-x)*.

### Value

a list of following comopnents.

`Y.imputed` |
The sample matrix Y with missing data imputed by EM |

`ParCor` |
the estimated partial correlation matrix. |

`sig.fit` |
numeric vector of the estimated diagonal |

`bic` |
BIC for the current estimate. |

### Author(s)

Shiyuan He

### 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

1 2 3 4 5 6 7 8 9 | ```
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
``` |