Learn R Programming

cglasso (version 2.0.7)

getMatrix: Retrieve Matrices ‘Y’ and ‘X’ from a ‘datacggm’ Object

Description

getMatrix’ retrieves matrices ‘Y’ and/or ‘X’ from an object of class ‘datacggm’.

Usage

getMatrix(x, name = c("Y", "X", "both"), ordered = FALSE)

Value

getMatrix retrieves the matrix specified by ‘name’ and with row ordering specified by ‘ordered’. A named list returned if name is "both".

Arguments

x

an object of class ‘datacggm’.

name

the name of the required matrix.

ordered

logical value used to specify if the required matrix should be retrieved with rows ordered according to the patterns of censored values. See below for some example.

Author

Luigi Augugliaro (luigi.augugliaro@unipa.it)

References

Augugliaro L., Sottile G., Wit E.C., and Vinciotti V. (2023) <tools:::Rd_expr_doi("10.18637/jss.v105.i01")>. cglasso: An R Package for Conditional Graphical Lasso Inference with Censored and Missing Values. Journal of Statistical Software 105(1), 1--58.

Augugliaro, L., Sottile, G., and Vinciotti, V. (2020) <tools:::Rd_expr_doi("10.1007/s11222-020-09945-7")>. The conditional censored graphical lasso estimator. Statistics and Computing 30, 1273--1289.

Augugliaro, L., Abbruzzo, A., and Vinciotti, V. (2020) <tools:::Rd_expr_doi("10.1093/biostatistics/kxy043")>. \(\ell_1\)-Penalized censored Gaussian graphical model. Biostatistics 21, e1--e16.

See Also

datacggm, rcggm.

Examples

Run this code
set.seed(123)

# a dataset from a  conditional censored Gaussian graphical model
n <- 100L
p <- 3L
q <- 2
b0 <- runif(p)
B <- matrix(runif(q * p), nrow = q, ncol = p)
X <- matrix(rnorm(n * q), nrow = n, ncol = q)
Z <- rcggm(n = n, b0 = b0, X = X, B = B, probl = 0.05, probr = 0.05)
getMatrix(Z, name = "Y")

# in the following examples 'Y' and 'X' is returned with rows ordered 
# according to the  patterns of censored data
getMatrix(Z, name = "Y", ordered = TRUE)

getMatrix(Z, name = "X")
getMatrix(Z, name = "X", ordered = TRUE)

getMatrix(Z, name = "both")
getMatrix(Z, name = "both", ordered = TRUE)

Run the code above in your browser using DataLab