Learn R Programming

cglasso (version 1.1.2)

event: Return the Indicator Matrix from an Object with class ‘datacggm

Description

The ‘event’ function is used to create a status indicator matrix from an object with class ‘datacggm’. The elements of the matrix, denoted by R, are used to specify the status of an observation:

  • R[i, j] = 0’ means that the \(i\)th observation of the \(j\)th random variable is observed;

  • R[i, j] = -1’ means that the \(i\)th observation of the \(j\)th random variable is left-censored;

  • R[i, j] = +1’ means that the \(i\)th observation of the \(j\)th random variable is right-censored.

See examples below.

Usage

event(x)

Arguments

x

an object with class ‘datacggm’.

Value

event returns a \((n\times p)\)-dimensional matrix.

References

Augugliaro, L., Abbruzzo, A. and Vinciotti, V. (2018). \(\ell_1\)-Penalized gaussian graphical model. Biostatistics (to appear).

See Also

datacggm, rdatacggm and the method function summary.datacggm.

Examples

Run this code
# NOT RUN {
set.seed(123)
library("cglasso")

# dataset from a left-censored Gaussian graphical model
n <- 100L
p <- 5L
X <- matrix(rnorm(n * p), n, p)
lo <- -1
X[X <= lo] <- lo
X <- datacggm(X, lo = lo)
event(X)

# dataset from a right-censored Gaussian graphical model
n <- 100L
p <- 5L
X <- matrix(rnorm(n * p), n, p)
up <- 1
X[X >= up] <- up
X <- datacggm(X, up = up)
event(X)

# dataset from a censored Gaussian graphical model
n <- 100L
p <- 5L
X <- matrix(rnorm(n * p), n, p)
up <- 1
lo <- -1
X[X >= up] <- up
X[X <= lo] <- lo
X <- datacggm(X, lo = lo, up = up)
event(X)
# }

Run the code above in your browser using DataLab