Learn R Programming

mice (version 2.30)

mice.impute.quadratic: Imputation of quadratric terms

Description

Imputes univariate missing data of incomplete variable that appears as both main effect and quadratic effect in the complete-data model.

Usage

mice.impute.quadratic(y, ry, x, ...)

Arguments

y

Incomplete data vector of length n

ry

Vector of missing data pattern (FALSE=missing, TRUE=observed)

x

Matrix (n x p) of complete covariates.

...

Other named arguments.

Value

A vector of length nmis with imputations.

Details

This implements polynomial combination method. First, the polynomial combination $Z = Y beta_1 + Y^2 beta_2$ is formed. $Z$ is imputed by predictive mean matching, followed by a decomposition of the imputed data $Z$ into components $Y$ and $Y^2$. See Van Buuren (2012, pp. 139-141) and Vink et al (2012) for more details. The method ensures that 1) the imputed data for $Y$ and $Y^2$ are mutually consistent, and 2) that provides unbiased estimates of the regression weights in a complete-data linear regression that use both $Y$ and $Y^2$.

References

van Buuren, S. (2012). Flexible Imputation of Missing Data. Boca Raton, FL: Chapman & Hall/CRC Press.

Vink, G., Frank, L.E., van Buuren, S. (2012). Multiple Imputation of Squares. Sociological Methods & Research, accepted for publication.

See Also

mice.impute.pmm

Examples

Run this code
# NOT RUN {
require(lattice)

# 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)

# 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")
points(complete(imp,1)$x[is.na(dat$x)], complete(imp,1)$xx[is.na(dat$x)], col=mdc(2))


# }

Run the code above in your browser using DataLab