plot.cglasso: Plot Method for "cglasso" Object

Description Usage Arguments Details Author(s) References See Also Examples

View source: R/cglasso_S3methods.R

Description

‘The plot.cglasso’ function produces plots to study the coefficient paths of fitted cglasso models.

Usage

1
2
3
4
5
## S3 method for class 'cglasso'
plot(x, what = c("Theta", "diag(Theta)", "b0", "B"), 
     penalty = ifelse(x$nrho >= x$nlambda, "rho", "lambda"), given = NULL,
     GoF = AIC, add.labels, matplot.arg1, matplot.arg2, labels.arg, abline.arg,
     mtext.arg, save.plot, grdev = pdf, grdev.arg, digits = 4L, ...)

Arguments

x

an R object of class ‘cglasso’, that is, the output of the fitting function cglasso.

what

a character or a formula specifying the required plot. If what is a character, then it is used to specify the conditional coefficient path. Allowed descriptors are: ‘Theta’, the off-diagonal entries of the precision matrix, ‘diag(Theta)’, the diagonal entries of the precision matrix, ‘b0’, the intercepts of the conditional models, or equivalently the expected values of the response variables, and ‘B’, the regression coefficients. Optionally, ‘what’ can be a model formula (see sections Description and Examples for more details).

penalty

optional character argument used to specify the tuning parameter needed to plot the conditional coefficient path. Allowed descriptors are ‘rho’ and ‘lambda’. This argument can be omitted if what is a model formula.

given

an optional vector of integers identifying the conditioning values of the second tuning parameter to be used for the coefficient profile plots of the parameters identified by the input ‘what’ across their corresponding tuning parameter. This argument is required only if ‘what’ is a character, otherwise it can be omitted.

GoF

a valid goodness-of-fit function, such as AIC.cglasso and BIC.cglasso, or an R object of class ‘GoF’.

add.labels

logical value. Should labels be added to the plot?

matplot.arg1

a named list with the graphical parameters used to plot the paths of the estimates identified by ‘GoF’.

matplot.arg2

a named list with the graphical parameters used to plot the paths of the remaining estimates.

labels.arg

a named list with the graphical parameters used to plot the labels.

abline.arg

a named list with the graphical parameters used to plot the line identifying the optimal tuning parameter value.

mtext.arg

a named list with the graphical parameters used to plot the text reported on the third axis.

save.plot

a logical variable or a string specifying the path of the directory where plots will be saved. Letting ‘save.plot = TRUE’, the required plots will be saved as external files inside the current working directory. User can save these files on a specific working directory passing the absolute path through the argument save.plot. On exit, working directory will be always set the previous one.

grdev

the graphics device used to save the required histograms on external files. See ‘device’ for more details.

grdev.arg

additional parameters passed to the graphics device specified by ‘grdev’.

digits

number of digits used to print the value of the second tuning parameter identified by ‘given’.

...

further arguments passed to the chosen goodness-of-fit function, such as ‘AIC’ or ‘BIC’.

Details

The function plot.cglasso produces the coefficient profile plot. The output depends both on the type of fitted model and on the setting of the three main arguments, what, penalty and given. Below we give more details.

If the model fitting function cglasso is used to fit an l1-penalized censored Gaussian graphical model (see first part in Section Example), then the user can specify only the main argument ‘what’, whereas ‘penalty’ and ‘given’ can be omitted. If ‘penalty’ is specified, then it must be equal to “rho”. The main argument ‘what’ is used to specify the estimator that is plotted on the y-axis. In this case, it must be equal to one of the following descriptors:

If a l1-penalized conditional censored Gaussian graphical model is fitted (see second part in Section Example), then all the main arguments can be used. In this case:

  1. what’ must be equal to one of the following descriptors:

    • Theta”: the path of the off-diagonal entries of the estimated precision matrix is returned;

    • diag(Theta)”: the path of the estimated partial correlation coefficients is returned;

    • b0”: the path of the estimated intercepts is returned;

    • B”: the path of the estimated regression coefficients is returned for each response variable;

  2. penalty’ is used to specify the tuning parameter that is reported on the x-axis and it must be equal to one of the following descriptors:

    • rho”: the tuning parameter used to penalize the precision matrix;

    • lambda”: the tuning parameter used to penalize the regression coefficient matrix;

  3. given’ is an optional vector of integers used to specify the values of the second tuning parameter. For instance, letting what = "Theta", penalty = "rho" and given = 1 then plot.cglasso returns the plot of the estimated partial correlation coefficients versus the rho-values and given the first value of the used lambda-values. If given is left unspecified then a sequence of conditional profile plot is returned, a plot for each value of the second tuning parameter.

Optionally, the user can specify a conditional profile plot using a model formula with the following template:

what ~ penalty | given

For instance, the previous plot can be specified using the following model formula

Theta ~ rho | 1

In this case, the arguments penalty and given must be left unspecified whereas what is used for the model formula (see also examples below).

The optional argument GoF can be used to identify the non-zero estimates by the output of a goodness-of-fit function, such as AIC.cglasso and BIC.cglasso. In this case, a vertical red dashed line is used the identify the optimal value of the tuning parameter reported on the x-axis, whereas the path of the identified non-zero estimates is drawn using a solid black line; the remaining paths are drawn using gray dashed lines. This option is disabled if we let ‘GoF = NULL’, when all the paths are drawn usign solid black lines.

Author(s)

Luigi Augugliaro (luigi.augugliaro@unipa.it)

References

Augugliaro, L., Abbruzzo, A., and Vinciotti, V. (2020a) <doi: 10.1093/biostatistics/kxy043>. l1-Penalized censored Gaussian graphical model. Biostatistics 21, e1–e16.

Augugliaro, L., Sottile, G., and Vinciotti, V. (2020b) <doi: 10.1007/s11222-020-09945-7>. The conditional censored graphical lasso estimator. Statistics and Computing 30, 1273–1289.

Friedman, J.H., Hastie, T., and Tibshirani, R. (2008) <doi: 10.1093/biostatistics/kxm045>. Sparse inverse covariance estimation with the graphical lasso. Biostatistics 9, 432–441.

Stadler, N. and Buhlmann, P. (2012) <doi: 10.1007/s11222-010-9219-7>. Missing values: sparse inverse covariance estimation and an extension to sparse regression. Statistics and Computing 22, 219–235.

See Also

cglasso, AIC.cglasso and BIC.cglasso.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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(. ~ ., data = 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(. ~ ., data = 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)

cglasso documentation built on April 9, 2021, 9:07 a.m.