Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BootEff in psem with interaction terms #54

Open
AlexCarrascosa opened this issue Mar 12, 2024 · 1 comment
Open

BootEff in psem with interaction terms #54

AlexCarrascosa opened this issue Mar 12, 2024 · 1 comment

Comments

@AlexCarrascosa
Copy link

AlexCarrascosa commented Mar 12, 2024

Hello¡
I'm trying to use the BootEff() function in a psem model composed of lmer models with some interaction terms (code attached at the end). I always get this error:

Warning message:
In (function (m, w) : 1001 model fit(s) or parameter estimation(s) failed. NAs reported/generated.

It seems that BootEff is not able to estimate these models. But, if I remove the interaction terms from the lmer models within the psem, it works perfectly. The problem is not related to random effects, because even with lm() models I get the same error when there are interaction terms.

Prod_psem <- psem(
lmer( Production ~ grass_proportion+
Treatment+Soil_fertility+Annual_Prep+
Treatment:Annual_Prep+
(1| Farm/Plot), data= Out_canopy_prod),

lmer( grass_proportion ~ Soil_fertility+Treatment+Mean_annual_Temp+
Annual_Prep+Treatment:Annual_Prep+
(1| Farm/Plot),data= Out_canopy_prod) ,

lmer(Soil_fertility ~ Treatment+
Mean_annual_Temp+(1| Farm),
data= Out_canopy_prod),
data = Out_canopy_prod)

Prod.sem.boot <- bootEff(Prod_psem, R = 1000, seed = 13, parallel = "snow", ran.eff = "Farm"))

Warning message:
In (function (m, w) :
1001 model fit(s) or parameter estimation(s) failed. NAs reported/generated.

I've also run the bootEff() including catch.err = FALSE and this is the error reported:

Error in contr.sum(levels(i)) :
not enough degrees of freedom to define contrasts

What goes wrong?

Thank you very much

@murphymv
Copy link
Owner

Hi Alex,

Without the data it's difficult to be certain what's going on. Is it possible to give the output of str(Out_canopy_prod)?

Regards,
Mark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants