0

I'm constructing a piecewise structural equation model using the piecewiseSEM package in R (Lefcheck - https://cran.r-project.org/web/packages/piecewiseSEM/vignettes/piecewiseSEM.html)

I already created the model set and I could evaluate the model fit, so the model itself works. Also, the data fits the model (p = 0.528).

But I do not succeed in extracting the path coefficients. This is the error i get: Error in cbind(Xlarge, Xsmall) : number of rows of matrices must match (see arg 2)

I already tried (but this did not work):

  • standardising my data because of the warning: Some predictor variables are on very different scales: consider rescaling

  • adapted my data (threw some NA values away)

This is my modellist:

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)
)

with "predatie" being a binary variable (yes or no) and all the rest continuous variables (gapfraction, plantgrootte, olsen_P & piek1)

Thanks in advance!

John Conde
  • 217,595
  • 99
  • 455
  • 496
geum
  • 1
  • 1

2 Answers2

0

Try installing the development version:

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

Replace list with psem and run the coefs or summary function. It will likely get rid of your error. If not, open a bug on Github!

WARNING: this will overwrite your current version from CRAN. You will need to reinstall from CRAN to get version 1.4 back.

jslefche
  • 4,379
  • 7
  • 39
  • 50
  • There was a problem with the NA values. After removing them, i succeeded in extracting the path coefficients and making the figure with the 'old' package. – geum Apr 12 '17 at 11:28
0

try to use lme (out of the nlme library) ilstead of glmer. As far as I understand, the fact that lmer does not provide p-values (while lme does) seems to be the problem here. Hope this works.

Yoan
  • 1