0 votes
684 views
in Report bugs/errors by thestepher (150 points)
Hi,

We're conducting a power analysis using wp.poisson to get the relative risk for different levels of a normally distributed predict (mean = 0, sd = 1). Our dependent variable is binary, but it was suggested that we use a poisson rather than logistic since the prevalence of the behavior we're observing is over 10% (22-40% has been observed in previous studies). The observed intercept in simulated data is -1.91, based on the 22% occurrence, so the IRR is 0.148. I used the relative risk for a small, medium and large effect as 1.22, 1.86, and 3.00, as suggested by Olivier et al (2017). I get an error when I try to run the medium and large effects of "non-finite function value." Here's my code:

medium <- wp.poisson(n = seq(40, 100, 10), exp0 = 0.15, exp1 = 1.86, alpha = 0.05, power = NULL, family = "normal", parameter = c(0, 1))

medium

 

Any suggestions for trouble shooting?

2 Answers

0 votes
by johnny (3.3k points)
selected by thestepher
 
Best answer
Thanks for the question. This issue seemed to be related to the integration function we used. For certain parameters, the integration gave very off values. We will try to fix the issue in the next few days.
by thestepher (150 points)
Thank you for your help!
0 votes
by johnny (3.3k points)

We have fixed the integration issue but it will take some time to push it to CRAN. If you need to use it now, you can use the following. Thanks.

library(WebPower)

source("https://webpower.psychstat.org/R/poisson.R")

wp.poisson(n = 40, exp0 = 0.15, exp1 = 3, alpha = 0.05, power = NULL, family = "normal", parameter = c(0, 1))

Using your example, the output is below

Power for Poisson regression

      n     power alpha exp0 exp1    beta0    beta1

     40 0.9534119  0.05 0.15    3 -1.89712 1.098612

     50 0.9825010  0.05 0.15    3 -1.89712 1.098612

     60 0.9937320  0.05 0.15    3 -1.89712 1.098612

     70 0.9978398  0.05 0.15    3 -1.89712 1.098612

     80 0.9992791  0.05 0.15    3 -1.89712 1.098612

     90 0.9997659  0.05 0.15    3 -1.89712 1.098612

    100 0.9999257  0.05 0.15    3 -1.89712 1.098612

URL: http://psychstat.org/poisson

...