## set the dimension and the sample size
p <- 50
n <- 40
## define the true precision matrix
Omega <- 2*diag(p)
Omega[1,1] <- p
Omega[1,2:p] <- 2/sqrt(2)
Omega[2:p,1] <- 2/sqrt(2)
## generate the distribution
set.seed(1)
X <- MASS::mvrnorm(n, rep.int(0,p), MASS::ginv(Omega))
## define the settings
settings <- list("diagElem"="AD", "OLS"=FALSE)
## estimate the parameters of the distribution
params <- desp(X,lambda=0,gamma=sqrt(2*log(p)),settings=settings)
## error of estimation measured by Frobenius norm
sqrt(sum((Omega - params$Omega)^2))
## increase the sample size and generate the distribution again
n <- 1000
X <- MASS::mvrnorm(n, rep.int(0,p), MASS::ginv(Omega))
## estimate the parameters of the distribution
params <- desp(X,lambda=0,gamma=sqrt(2*log(p)),settings=settings)
## error of estimation measured by Frobenius norm
sqrt(sum((Omega - params$Omega)^2))
Run the code above in your browser using DataLab