Sparse covariance estimation for Gaussian variables
randn('state',0);
n = 10;
N = 100;
Strue = sprandsym(n,0.5,0.01,1);
R = inv(full(Strue));
y_sample = sqrtm(R)*randn(n,N);
Y = cov(y_sample');
alpha = 50;
cvx_begin sdp
variable S(n,n) symmetric
maximize log_det(S) - trace(S*Y)
sum(sum(abs(S))) <= alpha
S >= 0
cvx_end
R_hat = inv(S);
S(find(S<1e-4)) = 0;
figure;
subplot(121);
spy(Strue);
title('Inverse of true covariance matrix')
subplot(122);
spy(S)
title('Inverse of estimated covariance matrix')
Successive approximation method to be employed.
SDPT3 will be called several times to refine the solution.
Original size: 501 variables, 221 equality constraints
For improved efficiency, SDPT3 is solving the dual problem.
Approximation size: 510 variables, 226 equality constraints
-----------------------------------------------------------------
Target Conic Solver
Precision Error Status
---------------------------
1.221e-04 6.977e-01 Solved
1.221e-04 4.490e-04 Solved
1.221e-04 5.906e-06 Solved
1.221e-04 0.000e+00 Solved
1.490e-08 0.000e+00 Solved
-----------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): -31.2401