impute {cglasso} | R Documentation |
Imputation of Missing and Censored Values
Description
Imputes multivariate missing and censored values.
Usage
impute(object, type = c("mar", "censored", "both"), lambda.new, rho.new)
Arguments
object |
an R object inheriting class ‘ |
type |
a description of the imputation required (see section ‘Description’). By default only the missing-at-random values are imputed. |
lambda.new |
value of the tuning parameter |
rho.new |
value of the tuning parameter |
Details
The impute
function returns the response matrix with the imputed missing-at-random values (‘type = "mar"
’), the imputed censored values (‘type = "censored"
’), or both (‘type = "both"
’).
If ‘type = "mar"
’ then, for each row, the missing response values are replaced with the expected values of a multivariate normal distribution conditioned on the observed response values.
If ‘type = "censored"
’ then, for each row, the censored response values are imputed using the expected values of a multivariate truncated normal distribution conditioned on the observed response values.
If ‘type = "both"
’ then missing-at-random and censored values are imputed. In this case the returned matrix corresponds to the working response matrix computed during the E-Step.
Value
The impute
function returns a response matrix with the required imputed data.
Author(s)
Luigi Augugliaro (luigi.augugliaro@unipa.it)
See Also
Model-fitting functions cglasso
, cggm
and the accessor functions coef.cglasso
, fitted.cglasso
, residuals.cglasso
and predict.cglasso
.
Examples
set.seed(123)
# Y ~ N(0, Sigma) and
# 1. probability of left/right censored values equal to 0.05
# 2. probability of missing-at-random values equal to 0.05
n <- 100L
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, probna = 0.05)
out <- cglasso(. ~ ., data = Z)
rho.new <- mean(out$rho)
# imputing missing values
Y.impute <- impute(out, type = "mar", rho.new = rho.new)
# imputing censored values
Y.impute <- impute(out, type = "censored", rho.new = rho.new)
# imputing missing and censored values
Y.impute <- impute(out, type = "both", rho.new = rho.new)
# Y ~ N(XB, Sigma) and
# 1. probability of left/right censored values equal to 0.05
# 2. probability of missing-at-random values equal to 0.05
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)
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,
probna = 0.05)
out <- cglasso(. ~ ., data = Z)
lambda.new <- mean(out$lambda)
rho.new <- mean(out$rho)
# imputing missing values
Y.impute <- impute(out, type = "mar", lambda.new = lambda.new, rho.new = rho.new)
# imputing censored values
Y.impute <- impute(out, type = "censored", lambda.new = lambda.new, rho.new = rho.new)
# imputing missing and censored values
Y.impute <- impute(out, type = "both", lambda.new = lambda.new, rho.new = rho.new)