Skip to main content
7 events
when toggle format what by license comment
Oct 19, 2010 at 3:03 comment added Farrel Great code but there is a problem. I am not as smart as you are. I need it broken down stepwise. I take it is runs the number of simulations? What is nn? Is it the number of subjects in the study? Then I see you created a distribution of covariates and made them determine a yes or a no depending on a threshold.
Oct 2, 2010 at 20:41 comment added Stephan Kolassa @chl: +1, thanks a lot! Here's the gist: gist.github.com/607968
Oct 2, 2010 at 20:20 comment added chl You can attach your code as a pastie (pastebin.com) or a Gist (gist.github.com) if you feel it's more convenient, and link back to it in your comment.
Oct 2, 2010 at 20:05 history edited Stephan Kolassa CC BY-SA 2.5
corrected spelling
Oct 2, 2010 at 20:04 comment added Stephan Kolassa @Farrel - here's a very short script, which assumes [0,1]-uniformly distributed covariates, an OR of 2 between the first and third quartile of the covariate and standard normal noise, leading to power .34 for n=100. I'd play around with this to see how sensitive everything is to my assumptions: runs <- 1000; nn <- 100; set.seed(2010); detections <- replicate(n=runs,expr={covariate <- runif(nn); outcome <- runif(nn)<1/(1+exp(-2*log(2)*covariate+rnorm(nn))); summary(glm(outcome~covariate,family="binomial"))$coefficients["covariate","Pr(>|z|)"] < .05}) cat("Power:",sum(detections)/runs,"\n")
Sep 25, 2010 at 2:07 comment added Farrel Do you have a worked case in R?
Sep 23, 2010 at 8:16 history answered Stephan Kolassa CC BY-SA 2.5