提取分段SEM的路径系数(结构方程模型)

时间:2017-04-11 15:49:33

标签: r piecewise r-lavaan sem

我正在使用R中的piecewiseSEM包构建分段结构方程模型(Lefcheck - https://cran.r-project.org/web/packages/piecewiseSEM/vignettes/piecewiseSEM.html

我已经创建了模型集,我可以评估模型拟合,因此模型本身可以工作。此外,数据符合模型(p = 0.528)。

但我没有成功提取路径系数。 这是我得到的错误:Error in cbind(Xlarge, Xsmall) : number of rows of matrices must match (see arg 2)

我已经尝试过(但这不起作用):

    由于警告:Some predictor variables are on very different scales: consider rescaling

  • 标准化我的数据

  • 调整了我的数据(抛出了一些NA值)

这是我的模特:

predatielijst = list(

  lmer(plantgrootte ~ gapfraction + olsen_P + (1|plot_ID), data = d),

  glmer(piek1 ~ gapfraction + olsen_P + plantgrootte + (1|plot_ID), 
       family = poisson, data = d),  

      glmer(predatie ~ piek1 + (1|plot_ID), family = binomial, data = d)
)

“predatie”是二元变量(是或否)和所有其他连续变量(gapfraction,plantgrootte,olsen_P& piek1)

提前致谢!

2 个答案:

答案 0 :(得分:0)

尝试安装开发版本:

library(devtools) install_github("jslefche/piecewiseSEM@2.0")

list替换为psem并运行coefssummary功能。它可能会摆脱你的错误。如果没有,请在Github上打开一个错误!

警告:这将覆盖CRAN的当前版本。您需要从CRAN重新安装才能获得1.4版本。

答案 1 :(得分:0)

尝试使用lme(在nlme库中)而不是glmer。据我所知,lmer不提供p值(虽然lme确实)这一事实似乎是这里的问题。 希望这有效。

相关问题