Learn R Programming

SparseTSCGM (version 2.2)

plot.tscgm: Plot sparse.tscgm objects from fitting chain graphical models with vector autoregressive process of order 2.

Description

plot.tscgm is a generic plot function that is adapted for objects of class sparse.tscgm.

Usage

"plot"(x, mat=c("precision","autoregression"),...)

Arguments

x
an object of class sparse.tscgm.
mat
Name of matrix to be plotted,i.e., either the precision matrix or vector autoregression matrix.
...
Arguments to be passed to graphical parameters (see par).

Value

Undirected or directed networks.

See Also

network

Examples

Run this code

set.seed(321)
datas <- sim.data(model="ar1", time=10,n.obs=10, n.var=5,prob0=0.35,
         network="scale-free")
data.fit <-  datas$data1

 res.tscgm <- sparse.tscgm(data=data.fit, lam1=NULL, lam2=NULL, nlambda=NULL, 
 model="ar1", optimality="bic_ext",control=list(maxit.out = 10, maxit.in = 100))
  
#Network visualization
 par(mfrow=c(2,1))
plot.tscgm(res.tscgm, mat="precision", main="Undirected network", pad = 0.01,
  label.pad = 0.3, label.col = 6, vertex.col = 5,vertex.cex = 1.5,
  edge.col = 4, mode = "fruchtermanreingold", interactive=FALSE)
       
plot.tscgm(res.tscgm, mat="autoregression", main="Directed network", pad = 0.01,
  label.pad = 0.3, label.col = 6, vertex.col = 5,vertex.cex = 1.5,
  edge.col = 4, mode = "fruchtermanreingold", interactive=FALSE)
  

Run the code above in your browser using DataLab