0
$\begingroup$

I'm using generalized linear mixed models from the lme4 package to do structural equation modelling using piecewiseSEM. It works fine when I use glmer with gaussian, poisson or negative binomal distributions, but it throws an error when I use binomial proportional data (proportion of seedlings that survived in each plot).

These are my models, which both run fine on their own:

    seedlings2=glmer(surviving.seedlings/original.seedlings~Fert.binary+Total.cover.June.20+Ecto.binary+light.log+(1|Block),family=binomial,weights=original.seedlings,data=d2)
    light2=lmer(light.log~Shelter.binary+Total.cover.June.20+(1|Block),data=d2)

And when I run the SEM, this error appears:

    model<-psem(
      seedlings2,
      light2
      )
    summary(model)
      |========================================================================== |  67%Error in eval(predvars, data, env) : 
      object 'original.seedlings' not found

So perhaps piecewise SEM is not recognizing the weights=original.seedlings argument? I've also tried running the model using cbind with columns containing the number of successes (surviving seedings) and the number of failures (dead seedlings) like this, but the same thing happens:

    seedlings2=glmer(cbind(surviving.seedlings/(original.seedlings-surviving.seedlings)~Fert.binary+Total.cover.June.20+Ecto.binary+light.log+(1|Block),family=binomial,data=d2)

I've tried calling original.seedlings using d2$original.seedlings, but this doesn't help.

Is there a way to get piecewiseSEM to recognise proportional binomial models?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.