Learn R Programming

basecamb (version 1.1.2)

fit_mult_impute_obs_outcome: Fit a model on multiply imputed data using only observations with non-missing outcome(s)

Description

This function is a wrapper for fitting models with Hmisc::fit.mult.impute() on a multiply imputed dataset generated with mice::mice(). Cases with a missing outcome in the original dataset are removed from the mids object by using the "subset" argument in Hmisc::fit.mult.impute().

Usage

fit_mult_impute_obs_outcome(mids, formula, fitter, ...)

Value

mod a fit.mult.impute object.

Arguments

mids

a mids object, i.e. the imputed dataset.

formula

a formula that describes the model to be fit. The outcome (y variable) in the formula will be used to remove missing cases.

fitter

a modeling function (not in quotes) that is compatible with Hmisc::fit.mult.impute().

...

additional arguments to Hmisc::fit.mult.impute().

Author

Till D. Best

Examples

Run this code
# create an imputed dataset
imputed_data <- mice::mice(airquality)

fit_mult_impute_obs_outcome(mids = imputed_data, formula = Ozone ~ Solar.R + Wind, fitter = glm)

Run the code above in your browser using DataLab