I would like to use the fiml.regression wrapper function to estimate an lm() model in lavaan: https://rdrr.io/github/jbiesanz/fabs/man/fiml.regression.html
But unfortunately, can't get the function to work due to error 'function could not find function "fiml.regression"':
library(remotes)
library(lavaan)
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)
Why doesn't the wrapper work? Do I have to load other packages?
I got the function fiml.regression() to work by just pasting the function code provided here into my R script.