Problem with sim.power {SWSamp}

I am trying to simulate power for the stepped wedge design using the SWSamp package. But getting errors when I try to achieve that for a binary outcome. my code is thus:

library(lme4)
library(Matrix)
library(SWSamp)

pow.bin <- sim.power(I=20, J=5, H=NULL, K=5, design='cohort', p1=0.13, b.trt=0.46, OR=0.55,
                     rho=0.02,  family='binomial', natural.scale='logit',
                     sig.level=0.05, n.cores=2)

However, I get this error:

Error in { : task 1 failed - "object 'OR' not found"

Can someone assist me to solve this delima?

Thanks in anticipation

in sim.power, OR is not a parameter of the function

That means it is evaluated as ... . Read the source code and try to understand how this function should be used in your case. I know nothing about what you are doing, but OR is mentioned here and after:


And it seems that natural.scale should be TRUE or FALSE and OR is defined internaly based on b.trt

Hope you'll find how to fix your issue.

1 Like

Thank you cderv, this is very helpful