# NOT RUN {
# simulate data with 1 negative correlation
set.seed(10010)
Sigma <- diag(50)*2
Sigma[1,2] <- Sigma[2,1] <- -.9
data <- exp(rmvnorm(50, runif(50, 0, 2), Sigma))
# normalize
data.f <- t(apply(data, 1, norm_to_total))
data.clr <- t(clr(data.f, 1))
# estimate
est.clr <- sparseiCov(data.clr, method='glasso')
est.f <- sparseiCov(data.f, method='glasso')
est.log <- sparseiCov(log(data), method='glasso')
# visualize results
par(mfrow=c(1,3))
image(as.matrix(est.log$path[[3]][1:5,1:5]))
image(as.matrix(est.clr$path[[3]][1:5,1:5]))
image(as.matrix(est.f$path[[3]][1:5,1:5]))
# }
Run the code above in your browser using DataLab