Learn R Programming

miceadds (version 3.17-44)

mice.impute.imputeR.lmFun: Wrapper Function to Imputation Methods in the imputeR Package

Description

The imputation methods "imputeR.lmFun" and "imputeR.cFun" provide interfaces to imputation methods in the imputeR package for continuous and binary data, respectively.

Usage

mice.impute.imputeR.lmFun(y, ry, x, Fun=NULL, draw_boot=TRUE, add_noise=TRUE, ... )

mice.impute.imputeR.cFun(y, ry, x, Fun=NULL, draw_boot=TRUE, ... )

Value

A vector of length nmis=sum(!ry) with imputed values.

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.

Fun

Name of imputation functions in imputeR package, e.g., imputeR::ridgeR, see Details.

draw_boot

Logical indicating whether a Bootstrap sample is taken for sampling model parameters

add_noise

Logical indicating whether empirical residuals should be added to predicted values

...

Further arguments to be passed

Details

Methods for continuous variables:

imputeR::CubistR, imputeR::glmboostR, imputeR::lassoR, imputeR::pcrR, imputeR::plsR, imputeR::ridgeR, imputeR::stepBackR, imputeR::stepBothR, imputeR::stepForR

Methods for binary variables: imputeR::gbmC, imputeR::lassoC, imputeR::ridgeC, imputeR::rpartC, imputeR::stepBackC, imputeR::stepBothC, imputeR::stepForC

Examples

Run this code
if (FALSE) {
#############################################################################
# EXAMPLE 1: Example with binary and continuous variables
#############################################################################

library(mice)
library(imputeR)

data(nhanes, package="mice")
dat <- nhanes
dat$hyp <- as.factor(dat$hyp)

#* define imputation methods
method <- c(age="",bmi="norm",hyp="imputeR.cFun",chl="imputeR.lmFun")
Fun <- list( hyp=imputeR::ridgeC, chl=imputeR::ridgeR)

#** do imputation
imp <- mice::mice(dat1, method=method, maxit=10, m=4, Fun=Fun)
summary(imp)
}

Run the code above in your browser using DataLab