View source: R/missing_data_lm_functions.R
fiml.regression | R Documentation |
Wrapper function to estimate an lm() model in lavaan under full information maximum likelihood to account for missing data.
fiml.regression(data, model)
data |
The dataset for the analysis. |
model |
A regression model from lm() |
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.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.