# NOT RUN {
set.seed(123)
################################################################################
# Model 1: censored glasso estimator (Augugliaro \emph{and other}, 2020a)
# Y ~ N(0, Sigma) and probability of left/right censored values equal to 0.05
################################################################################
n <- 100L
p <- 10L
rho <- 0.3
Sigma <- outer(1L:p, 1L:p, function(i, j) rho^abs(i - j))
Z <- rcggm(n = n, Sigma = Sigma, probl = 0.05, probr = 0.05)
out <- cglasso(Z)
# coefficient profile plot of the off-diagonal entries of the precision matrix
plot(out, what = "Theta")
# the same as
#plot(out, what = "Theta", penalty = "rho")
# the output of a goodness-of-fit function can be used to identify the
# non-zero estimates
plot(out, what = "Theta", GoF = bic)
# letting 'GoF = NULL' the previous option is disabled
plot(out, what = "Theta", GoF = NULL)
# coefficient profile plot of the diagonal entries of the precision matrix
plot(out, what = "diag(Theta)")
# coefficient profile plot of the expected values of the response variables
plot(out, what = "b0")
################################################################################
# Model 2: conditional censored glasso estimator (Augugliaro \emph{and other}, 2020b)
# Y ~ N(b0 + XB, Sigma) and probability of left/right censored values equal to 0.05
################################################################################
n <- 100L
p <- 10L
q <- 5L
b0 <- runif(p)
B <- matrix(runif(q * p), nrow = q, ncol = p)
X <- matrix(rnorm(n * q), nrow = n, ncol = q)
rho <- 0.3
Sigma <- outer(1L:p, 1L:p, function(i, j) rho^abs(i - j))
Z <- rcggm(n = n, b0 = b0, X = X, B = B, Sigma = Sigma, probl = 0.05, probr = 0.05)
out <- cglasso(Z)
# conditional profile plot of the estimater partial correlation coefficients versus
# the used values of the tunin parameter rho and given the first lambda-value
plot(out, what = "Theta", penalty = "rho", given = 1L)
out$lambda[1L]
lambda.id <- c(2, 4)
plot(out, what = "Theta", penalty = "rho", given = lambda.id)
out$lambda[lambda.id]
# in this case a sequence of ten conditional profile plots is returned, tha is a
# plot for each lambda-value.
plot(out, what = "Theta", penalty = "rho")
# optionally, the user can specify the conditional profile plots using the model
# formula
plot(out, what = Theta ~ rho | lambda.id)
lambda.id
plot(out, what = Theta ~ rho)
# the output of a goodness-of-fit function can be used to identify the
# non-zero estimates
plot(out, what = Theta ~ rho | 10, GoF = bic)
# letting 'GoF = NULL' the previous option is disabled
plot(out, what = Theta ~ rho | 10, GoF = NULL)
# }
Run the code above in your browser using DataLab