Last chance! 50% off unlimited learning
Sale ends in
Imputes incomplete variable that appears as both main effect and quadratic effect in the complete-data model.
mice.impute.quadratic(y, ry, x, wy = NULL, quad.outcome = NULL, ...)
Vector with imputed data, same type as y
, and of length
sum(wy)
Vector to be imputed
Logical vector of length length(y)
indicating the
the subset y[ry]
of elements in y
to which the imputation
model is fitted. The ry
generally distinguishes the observed
(TRUE
) and missing values (FALSE
) in y
.
Numeric design matrix with length(y)
rows with predictors for
y
. Matrix x
may have no missing values.
Logical vector of length length(y)
. A TRUE
value
indicates locations in y
for which imputations are created.
The name of the outcome in the quadratic analysis as a
character string. For example, if the substantive model of interest is
y ~ x + xx
, then "y"
would be the quad.outcome
Other named arguments.
Mingyang Cai and Gerko Vink
This function implements the "polynomial combination" method.
First, the polynomial
combination
mice.impute.pmm
Van Buuren, S. (2018).
Flexible Imputation of Missing Data. Second Edition.
Chapman & Hall/CRC. Boca Raton, FL.
Vink, G., van Buuren, S. (2013). Multiple Imputation of Squared Terms. Sociological Methods & Research, 42:598-607.
Other univariate imputation functions:
mice.impute.cart()
,
mice.impute.lasso.logreg()
,
mice.impute.lasso.norm()
,
mice.impute.lasso.select.logreg()
,
mice.impute.lasso.select.norm()
,
mice.impute.lda()
,
mice.impute.logreg.boot()
,
mice.impute.logreg()
,
mice.impute.mean()
,
mice.impute.midastouch()
,
mice.impute.mnar.logreg()
,
mice.impute.mpmm()
,
mice.impute.norm.boot()
,
mice.impute.norm.nob()
,
mice.impute.norm.predict()
,
mice.impute.norm()
,
mice.impute.pmm()
,
mice.impute.polr()
,
mice.impute.polyreg()
,
mice.impute.rf()
,
mice.impute.ri()
# Create Data
B1 <- .5
B2 <- .5
X <- rnorm(1000)
XX <- X^2
e <- rnorm(1000, 0, 1)
Y <- B1 * X + B2 * XX + e
dat <- data.frame(x = X, xx = XX, y = Y)
# Impose 25 percent MCAR Missingness
dat[0 == rbinom(1000, 1, 1 - .25), 1:2] <- NA
# Prepare data for imputation
ini <- mice(dat, maxit = 0)
meth <- c("quadratic", "~I(x^2)", "")
pred <- ini$pred
pred[, "xx"] <- 0
# Impute data
imp <- mice(dat, meth = meth, pred = pred, quad.outcome = "y")
# Pool results
pool(with(imp, lm(y ~ x + xx)))
# Plot results
stripplot(imp)
plot(dat$x, dat$xx, col = mdc(1), xlab = "x", ylab = "xx")
cmp <- complete(imp)
points(cmp$x[is.na(dat$x)], cmp$xx[is.na(dat$x)], col = mdc(2))
Run the code above in your browser using DataLab