plot.SJ: plot an object of class 'SJ' or 'SJ.dag'

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

View source: R/plot.SJ.R

Description

This function plots an SJ or SJ.dag

Usage

1
2
## S3 method for class 'SJ'
plot(x, which = NULL, layout = NULL, ...) 

Arguments

x

an object of class SJ or SJ.dag

which

The index of which to plot. If not specified, the penalty with the smallest BIC is used.

layout

the layout of the graph to use. If not specified, layout.fruchterman.reingold is used.

...

additional parameters to be passed to plot.igraph.

Details

This function plots a graph in SJ or SJ.dags 'graph' field, using some sane degaults for vertex size and color.

Value

returns the layout used, invisibly.

Author(s)

Arend Voorman

References

Voorman, Shojaie and Witten (2013). Graph Estimation with Joint Additive Models. Submitted to Biometrika. available on ArXiv or from authors upon request

See Also

plot.igraph spacejam SJ generate.dag.data

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
p <- 100 #variables
n <- 50 #observations

#Generate Data
set.seed(20)
g <- rdag(p,80)
data <- generate.dag.data(g,n,basesd=c(1,0.5,0.5))
X <- data$X

#Fit conditional independence graph for sequence of 10 lambdas
fit1 <- SJ(X, length = 10)

par(mfrow=c(1,2))
layout <- plot(fit1, main = "min BIC")
plot(fit1, which=5, layout = layout, main = paste0("lambda = ",round(fit1$lambda[5],3)))

spacejam documentation built on May 29, 2017, 11:28 p.m.