Last chance! 50% off unlimited learning
Sale ends in
The accessor function coef
extracts model coefficients from an R object inheriting class ‘cglasso
’.
# S3 method for cglasso
coef(object, type = c("all", "B", "Sigma", "Theta"), lambda.id, rho.id,
drop = TRUE, …)
a description of the desired estimates.
an optional vector of integers used to specify the
an optional vector of integers used to specify the
logical. Dimensions of the required objects can only be dropped if their extent is one.
further arguments passed to or from other methods.
Coefficients extracted from ‘object
’ are returned. By default, a named list storing all the estimated parameters is returned.
Model-fitting functions cglasso
, cggm
and the accessor functions fitted.cglasso
, residuals.cglasso
, predict.cglasso
and impute
.
# NOT RUN {
set.seed(123)
# Y ~ N(0, Sigma) and probability of left/right censored values equal to 0.05
n <- 1000L
p <- 3L
rho <- 0.3
Sigma <- outer(1L:p, 1L:p, function(i, j) rho^abs(i - j))
Z <- rcggm(n = n, Sigma = Sigma, probl = 0.05, probr = 0.05)
out <- cglasso(Z)
coef(out, type = "Theta", rho.id = 1:4)
coef(out, type = "Theta", rho.id = 3, drop = TRUE)
# Y ~ N(b0 + XB, Sigma) and probability of left/right censored values equal to 0.05
n <- 1000L
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)
rho <- 0.3
Sigma <- outer(1L:p, 1L:p, function(i, j) rho^abs(i - j))
Z <- rcggm(n = n, b0 = b0, X = X, B = B, Sigma = Sigma, probl = 0.05, probr = 0.05)
out <- cglasso(Z)
coef(out, type = "B", lambda.id = 3, rho.id = 1:4)
coef(out, type = "B", lambda.id = 3, rho.id = 3, drop = TRUE)
# }
Run the code above in your browser using DataLab