pitakakariki / simr

Power Analysis of Generalised Linear Mixed Models by Simulation
68 stars 19 forks source link

cannot use powerSim/doTest when p-values in coefficient results are not labelled "Pr(>|z|)" #209

Open a-ndreaaaaa opened 3 years ago

a-ndreaaaaa commented 3 years ago

Hi there,

I've fitted a model using geem2, and it outputs the p-values in the coefficients table as simply "p", not "Pr(>|z|)". This results in an error as powerSim/doTest only reads p-values when the label is "Pr(>|z|)". Is there any way I can work around this/respecify a[xname, "Pr(>|z|)"] such that the subscript is no longer out of bounds?

Thank you so much for your time!

doTest(geem3, test = fixed(xname = "aglcenXorder01", method = "z")) Error in a[xname, "Pr(>|z|)"] : subscript out of bounds

pitakakariki commented 3 years ago

simr doesn't support models outside of lm/glm/lmer/glmer yet, so I recommend treating any results with caution, even if it appears to work.

You can supply a function as the test argument, so you could try something like:

f <- function(fit) summary(fit)$coefficients["aglcanXorder01", "p"]

The function will need to take your model as an argument and return a p-value.