konfound-project / konfound

R package for carrying out sensitivity analysis
https://konfound-project.github.io/konfound/
Other
15 stars 7 forks source link

Not working for lmer in R #51

Open yutong010 opened 10 months ago

yutong010 commented 10 months ago

I estimate a mixed effects model in R with the scripts below: if (requireNamespace("lme4")) { library(lme4) m1 <- fm1 <-lmer(dv~ 1 + x1+ x2+ x3+ x4+ x5+(1|u_id), data) konfound(m1, x1) } But got an error: Error in konfound(m1, x1) : konfound() is currently implemented for models estimated with lm(), glm(), and lme4::lmer(); consider using pkonfound() instead

Not sure whether konfound support lmer or not? Thanks.

qinyun-lin commented 10 months ago

lmer does not make a decision about degree of freedom. There are debates around this issue. Thus, we recommend you making a decision about your degree of freedom and then call pkonfound to make the calculation. Hope this helps!

yutong010 commented 10 months ago

Thanks for the quick reply! Got it. Btw, I am confused if the RIR is applied to only the significant effects. In other words, if an estimate of my focal independent variable (i.e., X1) is statistically insignificant (p>0.1), indicating that I don't find a significant effect of X1 on Y, does applying the RIR framework to this null effect make sense?

kenfrank1 commented 10 months ago

RIR works for results that are not statistically significant as well as for results that are statistically significant. If the result is not statistically significant, we imagine that your observed data is a mixture of cases for which there is zero effect and others for which the effect is at the threshold of significance. RIR then reports what this mixture must be such that if the zero effect cases were replaced with cases that were just significant the final estimate would be just significant. For example: "The estimate would be statistically significant (p=.05) if you replaced XX% of the cases for which the effect was zero with cases for which the effect was exactly at the threshold of significance."