simr icon indicating copy to clipboard operation
simr copied to clipboard

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

Open a-ndreaaaaa opened this issue 3 years ago • 1 comments

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

a-ndreaaaaa avatar Apr 26 '21 10:04 a-ndreaaaaa

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.

pitakakariki avatar Apr 27 '21 03:04 pitakakariki