Error when trying to use imputed data for sem using “mi” package

99封情书 提交于 2019-12-23 05:15:47

问题


I am trying to conduct a path model with my imputed data but I can't figure out how to get my code to work.

A regular regression like this works fine with the pool function

analysis <- pool(outcome1 ~ variable1 + variable2,
             data = imputations, m = NULL)

But when I try to make it a path model it gives me errors.

e.g., of code I've tried

analysis <- pool(outcome1 + outcome2 ~ variable1 + variable2,
             data = imputations, m = NULL)

Error in pool(outcome1 + outcome2 ~ variable1 + variable2, data = imputations, : no variable called outcome1 + outcome2 possibly due to typo or transformation, in which case you need to specify 'FUN' explicitly

analysis <- sem(pool(outcome1 + outcome2 ~ variable1 + variable2,
             data = imputations, m = NULL))

Error in pool(outcome1 + outcome2 ~ variable1 + variable2, data = imputations, : no variable called outcome1 + outcome2 possibly due to typo or transformation, in which case you need to specify 'FUN' explicitly

analysis <- pool(outcome1 ~ variable1 + variable2
                  outcome2 ~ variable1 + variable2,
             data = imputations, m = NULL)

Error: unexpected ',' in " data = imputations,"

analysis <- 'outcome1 ~ variable1 + variable2
              outcome2 ~ variable1 + variable2'

 path <- sem(pool(analysis, data=imputations, m=NULL))

.Error in pool(analysis, data = imputations, m = NULL) : 'formula' must be a formula

I'm still new to r, any ideas of what I'm doing wrong?

来源:https://stackoverflow.com/questions/58630762/error-when-trying-to-use-imputed-data-for-sem-using-mi-package

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!