Apologies in advance for my lack of statistical knowledge/insight!

I am trying to calculate the sample size for a clinical trial of treatment A versus placebo with primary outcome of prolongation of treatment time ('the longer the better'). We know that the primary outcome is skewed. The minimal clinically relevant treatment effect would be a difference of 5 days between the medians.

As suggested by prof. Harrell, I have tried calculating the sample size using a proportional odds model based on data from a similar (already published) trial. I based my calculations on this example: https://www.fharrell.com/post/pop/

However, I am unsure whether I have provided the right input for the functions popower and pomodm in R.

This is my code:

pwr.t.test(n=180/2, d=5/sd(p), type = 'two.sample') The previous trial had 180 patients in total (90 treatment A, 90 placebo); this yield a power of 44% to detect a difference of 5 days (in means) (two-sample t-test), which I think can be improved by using a proportional odds model instead.

p <- df_placebo$`prolongation in days, where p is a list of prolongation in days (non-integer, unique values) for each patient in the placebo group from the previous trial. Am I correct in only using placebo data for the sample size calculation?

kp <- table (p); kp <- kp /sum(kp), this is based on the example blog-post but I am not sure whether this is correct for my case or whether I should input a table of probabilities based on frequencies instead (which would be 1/90 for every 'prolongation level', as there are 90 patients in the placebo group and each 'prolongation' is a unique value.

kx <- as.numeric(names(kp))


w <- pomodm(kx, kp, odds.ratio=1.0), this yields the original mean and median for the placebo group, which to me seems correct.

Next step to find out which OR corresponds to a difference in medians of 5 days between placebo and treatment group:

z <- data.table(or=ors)
u <- z[, as.list(pomodm(kx, kp, odds.ratio=or) - w), by=or]
m <- meltData(or ~ mean + median, data=u)   
ggplot(m, aes(x=or, y=value, color=variable)) + geom_line() +
  geom_vline(xintercept=1.29, alpha=0.3) +
  geom_hline(yintercept=5) + 
  guides(color=guide_legend(title='')) +
  xlab('Odds Ratio') + ylab('Difference Between Groups') 

enter image description here

A five-day increase seems to correspond to an OR of 1.29. But if I input this into popower this yields a power of only 16% with 180 patients in total. popower(kp, odds.ratio=1.29, 180)

I am not sure what I am doing wrong. So sorry if this is not a very smart question; R and statistics are very new to me and I have just started learning more a few weeks ago by reading articles and blog posts.

Thank you all very much in advance for your help. Catherina

Edited to show distribution of prolongation data (ln-transformed, blue = placebo, red = treatment A, from previous trial): Red = treatment A, blue = placebo (data from previous trial)

Prolongation data on the original scale (placebo and treatment A, respectively): enter image description here

enter image description here


1 Answer 1


You've done a good job Catherina. Yes, the external data from a placebo group forms the reference data. table(p) / sum(table(p)) is the right vector; it is the relative frequencies. A minor issue is that popower wants you to provide relative frequencies that are averaged over control and treatment subjects. If you let $a$ be square root of the odds ratio, you can apply an odds ratio of $a$ to the placebo proportions to get the proportions for the between-treatment average. I wish I had used the control group for the proportions in popower and posamsize. To check the calculations you can apply an odds ratio of $\frac{1}{a}$ to the modified proportions to make sure you get the original placebo proportions.

The bigger questions are

  • which effect size to use in computing power (mean vs. median)
  • what is the real MCID, i.e., were the experts right in say a difference in medians of 5? Did they assume the mean and median were the same when selecting 5?

The only way I can think of to explore this is to find a transformation of p that yields a symmetric distribution, and solve for the difference in means on that transformed scale that corresponds to a difference in medians of 5 on the original scale. Compute the SD on that transformed scale and repeat pwr.t.test on the just-solved-for difference in means. That should be more comparable to popower.

  • $\begingroup$ Thank you! Using the square root of the odds ratio to obtain relative frequencies averaged over control and treatment subjects indeed did not impact the power very much; still 15% when aiming for a difference of 5 days in medians (part I). $\endgroup$ Commented Apr 28 at 19:01
  • $\begingroup$ The closest I could get to a symmetric distribution was by ln-transforming the data, althought the distribution was not log-normal. Then I did this: mean_placebo <- 2.25039457 # mean of log normal transformed data in previous trial mean_treatment <- log(exp(mean_placebo) + 5) #MCRD of 5 days on the untransformed scale (not sure if this is right) MCRD <- mean_treatment - mean_placebo #log-scale MCRD sd_log <- 1.23184 # Standard deviation on the log scale pwr.t.test(n=180/2, d=MCRD/sd_log, type = 'two.sample') This yields a power of 63%. $\endgroup$ Commented Apr 28 at 19:04
  • $\begingroup$ I also tried doing the following: applied the OR matching a 5 day difference in medians on the data on the original scale, ln-transformed the data, calculated the difference in means on the transformed scale and the SD on the transformed scale and then repeated pwr.t.test with this difference in means. This yields a power of 11% (more comparable to popower). $\endgroup$ Commented Apr 29 at 6:55
  • $\begingroup$ Hard to figure out. In the graph above you show negative values of prolongation of treatment. How can that be? How did you take logs then? $\endgroup$ Commented Apr 29 at 11:10
  • $\begingroup$ The graph with the red and blue lines are the ln-transformed data (sorry that wasn't clear; some prolongation times were really short, leading to negative values when ln-transformed). I have added descriptions of the untransformed data as well (for placebo and treatment A). $\endgroup$ Commented Apr 29 at 12:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.