fiml.regression: Wrapper function to estimate an lm() model in lavaan under...

View source: R/missing_data_lm_functions.R

fiml.regressionR Documentation

Wrapper function to estimate an lm() model in lavaan under full information maximum likelihood to account for missing data.

Description

Wrapper function to estimate an lm() model in lavaan under full information maximum likelihood to account for missing data.

Usage

fiml.regression(data, model)

Arguments

data

The dataset for the analysis.

model

A regression model from lm()

Value

Returns (1) a dataset with the 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 df = n*(1-gamma) where n is the number of rows in the dataset. Both N.effective and df are rounded down. (2) sigma which estimates the residual standard error. Assumnes that fixed.x = F.

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)
fiml.regression(data=temp_data, model=lm_model)

## End(Not run)

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