This uses the COM interface, so only works on Windows.
library(glasso)
b =
1 4 9 16 25 36 49 64 81 100
c =
2 5 10 17 26 37 50 65 82 101
!R --no-save # at the matlab prompt q() # at the R prompt to quit.
function precMat = glassoR(C, rho, useMBapprox)
% Use L1-linear regression to find markov blankets and then Lambda.
% Uses R code from http://www-stat.stanford.edu/~tibs/glasso/
openR;
evalR('C<-1') % must pre-declare variable before writing a matrix
evalR('L<-1')
putRdata('C',C);
putRdata('rho',rho);
putRdata('useMBapprox', useMBapprox)
evalR('stuff <- glasso(C,rho=rho,approx=useMBapprox)');
evalR('L <- stuff$wi') % inverse covariance matrix
precMat = getRdata('L');
closeR;