norm.regression: Function to automate multiple imputation (MI) for missing...

View source: R/missing_data_lm_functions.R

norm.regressionR Documentation

Function to automate multiple imputation (MI) for missing data using the norm package for an lm() regression model.

Description

Function to automate multiple imputation (MI) for missing data using the norm package for an lm() regression model.

Usage

norm.regression(data, model, m = 100, standardize = F, digits = 6)

Arguments

data

The dataset for the analysis.

model

A regression model from lm()

m

Number of imputations to conduct

standardize

Whether or not to standardize each imputed dataset before rerunning the lm() model on that imputed dataset.

digits

Number of digits to print.

Value

Returns a dataset with the lm() regression terms, average regression coefficients under MI, standard errors, t.test, df calculated using Barnard and Rubin (1999), gamma ML regression estimates under FIML assuming either missing at random or missing completely at random, standard errors, t-test statistic, p-values under t-distribution, gamma (estimated fraction of missing data), N.effective (estimated equivalent complete data sample size), and efficiency = 1/(1 + gamma/m). and df = n*(1-gamma) where n is the number of rows in the dataset. Both N.effective and df are rounded down.

Examples

## Not run: 
x <- c(1,2,3,4,5,NA,NA,7,7,7,7)
y <- c(2.1,NA,2.1,1.8,2,2.2,4,NA,7,7,7)
temp_data <- as.data.frame(cbind(y, x))
lm_model <- lm(y~x, data=temp_data)
norm.regression(data=temp_data, model=lm_model)

## End(Not run)

jbiesanz/fabs documentation built on July 15, 2022, 11:02 p.m.