plot.cglasso2igraph {cglasso}R Documentation

Plot Method for a cglasso2igraph Object"

Description

plot.cglasso2igraph produces graphs from an R object of class ‘cglasso2igraph’.

Usage

## S3 method for class 'cglasso2igraph'
plot(x, type, ...)

Arguments

x

an R object of class ‘cglasso2igraph’, that is, the output of the function to_graph.

type

a description of the required graph. Default is ‘both’ in a conditional glasso estimator or ‘Gyy’ in a glasso estimator (see getGraph).

...

additional graphical arguments passed to the functions plot.igraph.

Author(s)

Luigi Augugliaro (luigi.augugliaro@unipa.it)

See Also

to_graph and getGraph.

Examples

set.seed(123)
# Y ~ N(0, Sigma) and probability of left/right censored values equal to 0.05
n <- 100L
p <- 3L
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)
out.graph <- to_graph(out)
plot(out.graph, type = "Gyy")

out.graph <- to_graph(out, weighted = TRUE)
plot(out.graph,  type = "Gyy")


# Y ~ N(b0 +XB, Sigma)  and probability of left/right censored values equal to 0.05
n <- 100L
p <- 3L
q <- 2L
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)
out.graph <- to_graph(out, lambda.id = 3, rho.id = 3, weighted = TRUE)
plot(out.graph, type = "Gyy")
plot(out.graph, type = "Gxy")
plot(out.graph, type = "both")

[Package cglasso version 2.0.7 Index]