kollerma / robustlmm

This is an R-package for fitting linear mixed effects models in a robust manner. The method is based on the robustification of the scoring equations and an application of the Design Adaptive Scale approach.
28 stars 9 forks source link

ANOVA and P-values: PR or separate package? #31

Open LGraz opened 2 weeks ago

LGraz commented 2 weeks ago

Dear @kollerma

I am currently implementing my own way how to get sensible p-values for an rlmerMod model and I would like to share it with the world.

lmerTest uses the contest / contestMD / contest1D functions to get their p-values. Then all contrasts and ANOVAs (= simultaneous contrasts) are performed in the aforementioned functions and testing against 0.

Since I don't think we can work with the classic sums of squares, I have implemented a test, that using the Hotelling t-squared statistic and a contrast matrix $K$, tests the nullhypothethis : $K \times fixef(fit) = 0$ by computing the test-statistic t(K %*% fixef(fit)) %*% solve(K %*% vcov(fit) %*%K ) %*% K %*% fixef(fit) which under the null follows the distribution $\frac{p * (n - 1)}{n - p}F_{p, n - p}$.

I have tested this approach for the sleepstudy data, simulating under the null. Using my ANOVA method, I got a .95 correlation with anova.lmerModLmerTest and in an unbalanced case it is slightly more conservative.

Would you be interested in a PR? Or should I publish this separately?

kollerma commented 2 weeks ago

Dear @LGraz ,

Thanks for taking the initiative to add this functionality. Yes, I am interested in a PR that implements this. It would be great if the PR could include a few simple tests that help to ensure that things keep working.

Best, Manuel