Learn R Programming

cglasso (version 2.0.7)

dim.datacggm: Dimensions of a “datacggm” Object

Description

Retrieve the dimension of an R object of class “datacggm”, that is, the sample size (\(n\)), the number of response variables (\(p\)) and the number of predictors (\(q\)).

Usage

# S3 method for datacggm
dim(x)

Value

For an object of class ‘datacggm’, dim retrieves a named list with components Y and X which are the “dim” attribute of the two matrices, respectively. If X is missing then the last component is NULL.

Arguments

x

an R object of class ‘datacggm’.

Author

Luigi Augugliaro (luigi.augugliaro@unipa.it)

Details

For an R object of class ‘datacggm’, dim retrieves a list with elements named Y and X. The first component is the “dim” attribute of the matrix Y whereas the second component is the “dim” attribute of the matrix X. If X is missing, the second component is NULL.

See Also

datacggm, rcggm,nobs, nresp and npred.

Examples

Run this code
set.seed(123)
# a dataset from a censored Gaussian graphical model
n <- 100L
p <- 3L
b0 <- rep(0, p)
Z <- rcggm(n = n, b0 = b0, probl = 0.05, probr = 0.05)
dim(Z)

# 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)
dim(Z)

Run the code above in your browser using DataLab