Type: Package
Title: Sparse Time Series Chain Graphical Models
Version: 4.1
Date: 2025-12-12
Maintainer: Fentaw Abegaz <fentawabegaz@yahoo.com>
Depends: R (≥ 3.5.0)
Imports: glasso, longitudinal, huge, MASS, mvtnorm, network, abind, stats
Description: Computes sparse vector autoregressive coefficients and sparse precision matrices for time series chain graphical models. Methods are described in Abegaz and Wit (2013) <doi:10.1093/biostatistics/kxt005>.
License: GPL (≥ 3)
Encoding: UTF-8
NeedsCompilation: yes
RoxygenNote: 7.3.2
Packaged: 2025-12-29 15:53:07 UTC; fenta
Author: Fentaw Abegaz [aut, cre], Ernst Wit [aut]
Repository: CRAN
Date/Publication: 2026-01-09 10:10:02 UTC

Sparse Time Series Chain Graphical Models.

Description

Computes sparse autoregressive coefficient and precision matrices for time series chain graphical models(TSCGM). These models provide an effeicient way of simultaneously dealing with Gaussian graphical models (undirected graphs for instantaneous interactions) and Bayesian networks (directed graphs for dynamic interactions) for reconstructing instantaneous and dynamic networks from repeated multivariate time series data.

Details

Package: SparseTSCGM
Type: Package
Version: 4.1
Date: 2025-12-12
License: GPL (>=3)
LazyLoad: yes

Author(s)

Fentaw Abegaz and Ernst Wit

Maintainer: Fentaw Abegaz <fentawabegaz@yahoo.com>

References

Fentaw Abegaz and Ernst Wit (2013). Sparse time series chain graphical models for reconstructing genetic networks. Biostatistics. 14, 3: 586-599.

Rothman, A.J., Levina, E., and Zhu, J. (2010). Sparse multivariate regression with covariance estimation. Journal of Computational and Graphical Statistics. 19: 947–962.

Examples

seed = 321
datas <- sim.data(model="ar1", time=10,n.obs=10, n.var=5,seed=seed,prob0=0.35,
         network="random")
data.fit <-  datas$data1
prec_true <- datas$theta
autoR_true <- datas$gamma
   
res.tscgm <- sparse.tscgm(data=data.fit, lam1=NULL, lam2=NULL, nlambda=NULL, 
 model="ar1", penalty="scad", optimality="bic_mod",
 control=list(maxit.out = 10, maxit.in = 100))
   
#Estimated sparse precision and autoregression matrices
prec <- res.tscgm$theta
autoR <- res.tscgm$gamma

#Graphical visualization

oldpar <- par(mfrow = c(1, 1))
par(mfrow = c(2, 2))

plot.tscgm(datas, mat="precision",main="True precision matrix")         
plot.tscgm(res.tscgm, mat="precision",main="Estimated precision matrix")     
plot.tscgm(datas, mat="autoregression",main="True autoregression coef. matrix")    
plot.tscgm(res.tscgm, mat="autoregression",
           main="Estimated autoregression coef. matrix") 
par(oldpar)

Microarray gene expression time course data for mammary gland development in mice

Description

The data contains 30 genes identified using cluster analysis from 12488 probe sets representing approximately 8600 genes. The data are measured over 54 arrays of 3 replicates each on 18 time points of the developmental stages of mammary gland in mice. See Stein et al. (2004) for more details.

Usage

data(mammary)

Format

Data is in longitudinal format with 30 columns, 54 rows and a number of extra attributes (see R package longitudinal).

Source

This data is described in Stein et al. (2004) and can be freely obtained from the R package smida.

References

Stein T, Morris J, Davies C, Weber Hall S, Duffy M, Heath V, Bell A, Ferrier R, Sandilands G, Gusterson B, et al. (2004). Involution of the mouse mammary gland is associated with an immune cascade and an acute phase response, involving LBP, CD14 and STAT3. Breast Cancer Res, 6(2), R 75 - 91.

Wit E. and McClure J. (2004). Statistics for Microarrays: Design, Analysis and Inference. Wiley.

Examples

# load "longitudinal" library
library(longitudinal)

# load data sets
data(mammary)

Plot method for tscgm objects

Description

Plots matrices from tscgm objects. You can choose to plot the precision matrix or the autoregressive coefficient matrix.

Usage

## S3 method for class 'tscgm'
plot(x, mat = c("precision", "autoregression"), ...)

Arguments

x

An object of class tscgm.

mat

Character. Which matrix to plot. Choices are "precision" or "autoregression".

...

Additional plotting arguments passed to the plotting function.


Plot method for tscgm.ar2 objects

Description

Plots matrices from tscgm.ar2 objects. You can choose to plot the precision matrix, the first-order autoregressive matrix, or the second-order autoregressive matrix.

Usage

## S3 method for class 'tscgm.ar2'
plot(x, mat = c("precision", "autoregression1", "autoregression2"), ...)

Arguments

x

An object of class tscgm.ar2.

mat

Character. Which matrix to plot. Choices are "precision", "autoregression1", or "autoregression2".

...

Additional plotting arguments passed to the plotting function.


Print method for tscgm objects

Description

Print method for tscgm objects

Usage

## S3 method for class 'tscgm'
print(x, ...)

Arguments

x

An object of class tscgm

...

Further arguments


Multivariate time series simulation with chain graphical models

Description

Generates sparse vector autoregressive coefficients matrices and precision matrix from various network structures and using these matrices generates repeated multivariate time series dataset.

Usage

 sim.data(model=c("ar1","ar2"),time=time,n.obs=n.obs, n.var=n.var,seed=NULL,
          prob0=NULL, network=c("random","scale-free","hub","user_defined"),
          prec=NULL,gamma1=NULL,gamma2=NULL)

Arguments

model

Specifies the order of vector autoregressive models. Vector autoregressive model of order 1 is applied if model = "ar1" and Vector autoregressive model of order 2 is applied if method = "ar2".

time

Number of time points.

n.obs

Number of observations or replicates.

n.var

Number of variables.

seed

Random number seed.

prob0

Initial sparsity level.

network

Specifies the type of network structure. This could be random, scale-free, hub or user defined structures. Details on simultions from the various network structures can be found in the R package flare.

prec

Precision matrix.

gamma1

Autoregressive coefficients matrix at time lag 1.

gamma2

Autoregressive coefficients matrix at time lag 2.

Value

A list containing:

theta

Sparse precision matrix.

gamma

Sparse autoregressive coefficients matrix.

sigma

Covariance matrix.

data1

Repeated multivariate time series data in longitudinal format.

Author(s)

Fentaw Abegaz and Ernst Wit

Examples

seed = 321
datas <- sim.data(model="ar1", time=4,n.obs=3, n.var=5,seed=seed,prob0=0.35,
         network="random")
data.ts <-  datas$data1
prec_true <- datas$theta
autoR_true <- datas$gamma

Sparse time series chain graphical models

Description

Computes sparse vector autoregressive coefficient matrices of order 1 and 2 and precision matrix estimates for time series chain graphical models using SCAD or LASSO penalties. In time series chain graphs, directed edges are identified by nonzero entries of the autoregressive coefficients matrix and undirected edges are identified by nonzero entries of the precision matrix.

Usage

sparse.tscgm(
  data = data,
  lam1 = NULL,
  lam2 = NULL,
  nlambda = NULL,
  model = c("ar1", "ar2"),
  penalty = c("scad", "lasso"),
  optimality = c("NULL", "bic", "bic_ext", "bic_mod", "aic", "gic"),
  control = list()
)

Arguments

data

Longitudinal data format (matrix or data.frame).

lam1

Numeric. Scalar or vector of tuning parameter values for the precision matrix penalty. If NULL, the program generates a sequence based on nlambda.

lam2

Numeric. Scalar or vector of tuning parameter values for the autoregression matrix penalty. If NULL, a sequence is generated based on nlambda.

nlambda

Integer. Number of tuning parameter values to generate if lam1 or lam2 are NULL. Default is 10.

model

Character. Order of the vector autoregressive model. Choices: "ar1" or "ar2".

penalty

Character. Type of penalty to use. Choices: "scad" (default) or "lasso".

optimality

Character. Information criterion for model selection. Choices: "NULL" (no selection), "bic", "bic_ext", "bic_mod", "aic", "gic".

control

List. Control parameters for the algorithm:

maxit.out

Maximum outer iterations (default 5).

maxit.in

Maximum inner iterations (default 50).

tol.out

Convergence tolerance (default 1e-4).

silent

TRUE/FALSE, whether to print progress messages (default TRUE).

Details

For description of the objective functions and computational details, see Abegaz and Wit (2013).

Value

A list containing:

theta

Estimated precision matrix. Nonzero entries represent undirected edges.

gamma

Estimated autoregressive coefficient matrix. Nonzero entries represent directed edges.

lam1.opt

Optimal tuning parameter for the precision matrix.

lam2.opt

Optimal tuning parameter for the autoregression matrix.

min.ic

Minimum value of the selected information criterion.

tun.ic

Matrix of tuning parameters and corresponding information criterion values.

lam1.seq

Sequence of precision matrix tuning parameters.

lam2.seq

Sequence of autoregression matrix tuning parameters.

s.theta

Sparsity level of the precision matrix.

s.gamma

Sparsity level of the autoregression matrix.

References

Fentaw Abegaz and Ernst Wit (2013). Sparse time series chain graphical models for reconstructing genetic networks. Biostatistics, 14(3), 586–599.

Rothman, Levina, and Zhu (2010). Sparse multivariate regression with covariance estimation. Journal of Computational and Graphical Statistics, 19, 947–962.

Examples

seed <- 321
datas <- sim.data(model="ar1", time=10, n.obs=10, n.var=5, seed=seed, prob0=0.35, network="random")
data.fit <- datas$data1
prec_true <- datas$theta
autoR_true <- datas$gamma

res.tscgm <- sparse.tscgm(data=data.fit, lam1=NULL, lam2=NULL, nlambda=NULL, 
  model="ar1", penalty="scad", optimality="bic_mod", 
  control=list(maxit.out=10, maxit.in=100))

# Estimated sparse precision and autoregression matrices
prec <- res.tscgm$theta
autoR <- res.tscgm$gamma

# Optimal tuning parameter values
lambda1.opt <- res.tscgm$lam1.opt
lambda2.opt <- res.tscgm$lam2.opt

# Sparsity levels
sparsity_theta <- res.tscgm$s.theta
sparsity_gamma <- res.tscgm$s.gamma

# Graphical visualization
oldpar <- par(mfrow=c(2,2))
plot.tscgm(datas, mat="precision", main="True precision matrix")
plot.tscgm(res.tscgm, mat="precision", main="Estimated precision matrix")
plot.tscgm(datas, mat="autoregression", main="True autoregression coef. matrix")
plot.tscgm(res.tscgm, mat="autoregression", main="Estimated autoregression coef. matrix")
par(oldpar)

Summary method for tscgm objects

Description

Summary method for tscgm objects

Usage

## S3 method for class 'tscgm'
summary(object, ...)

Arguments

object

An object of class tscgm

...

Further arguments