adayim / consort

Create CONSORT diagrams for clinical studies.
Other
28 stars 4 forks source link

Two level randomisation/stratification #13

Open adayim opened 1 year ago

adayim commented 1 year ago

Some studies may first stratify patients then randomise. A typical case is the factorial design.

riinuots commented 5 months ago

Your package is an absolute timesaver! Thanks so much. Two-level stratification would be an amazing addition. Is there anything I can do to help?

adayim commented 3 months ago

Thanks for offering the help, I am thinking the best way to implement this. On the user side, you can just provide another allocation (split) variable, but it is difficult to record the split internally. I will let you know once I have some ideas on this.

KWigg4 commented 3 months ago

Hi!! I am in need of a second allocation variable as you mentioned is possible on the user side, but can't get it to work. Do you have an example? Is it still possible?

We have two arms that practices could opt in to, and then one of those arms branches again, and adding a second allocation doesn't work - any ideas?

TY!!

adayim commented 2 months ago

Hi,

I have updated the package on GitHub. Can you have a look and try? I am not sure if the examples and documentation is clear enough. But hope the examples would help. For two level randomisation, you can simply provide another allocation variable. I have done more updates as well. Please let me know if this works for you.

library(consort)
data(dispos.data)

df <- dispos.data[!dispos.data$arm3 %in% "Trt C",]
g <- consort_plot(data = df,
                  orders = c(trialno = "Population",
                             exclusion1    = "Excluded",
                             induction   = "Induction",
                             exclusion2    = "Excluded",
                             arm = "Randomized patient",
                             arm3     = "",
                             subjid_notdosed = "Not dosed",
                             mitt = "Final miTT Analysis"),
                  side_box = c("exclusion1", "exclusion2", "subjid_notdosed"),
                  allocation = c("arm", "arm3"), # Two level stratification
                  labels = c("1" = "Screening", "2" = "Month 4",
                             "3" = "Randomization", 
                             "6" = "End of study"),
                  cex = 0.7)