fitted.cglasso: Extract Model Fitted Values

View source: R/cglasso_S3methods.R

fittedR Documentation

Extract Model Fitted Values

Description

The accessor function fitted extracts model fitted values from an R object inheriting class ‘cglasso’.

Usage

## S3 method for class 'cglasso'
fitted(object, lambda.id, rho.id, drop = TRUE, ...)

Arguments

object

an R object inheriting class ‘cglasso’, that is, the output of the model-fitting functions cglasso or cggm.

lambda.id

a vector of integers used to specify the lambda-values.

rho.id

a vector of integers used to specify the rho-values.

drop

logical. Dimensions can only be dropped if their extent is one.

...

further arguments passed to or from other methods.

Value

Fitted values extracted from ‘object’ are returned.

Author(s)

Luigi Augugliaro (luigi.augugliaro@unipa.it)

See Also

Model-fitting functions cglasso, cggm and the accessor functions coef.cglasso, residuals.cglasso, predict.cglasso and impute.

Examples

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(. ~ ., data = Z)
fitted(out, rho.id = 3L, 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(. ~ ., data = Z)
fitted(out, lambda.id = 3L, rho.id = 3L, drop = TRUE)

cglasso documentation built on Jan. 17, 2023, 5:10 p.m.