gpaux / Mediana

Clinical Trial Simulations
http://gpaux.github.io/Mediana
26 stars 2 forks source link

Marginal power calculation with sample size higher than 1000 in survival #2

Closed ipval6 closed 4 years ago

ipval6 commented 4 years ago

Congratulations for your nice package

I am trying to estimate marginal power in a clinical scenario with different sample sizes. The problem is when I reach large sample size (> 1000), the result gets NaN. I have no idea why it is happening but seems rare... I attach the example. I would really appreciate if you can help me with this. Probably, I am not considering some factor.

Thanks in advance, Irene

Requirements

require(Mediana)

Adjusting rate to experimental data

analysis.model = AnalysisModel() + Test(id = "Placebo vs treatment", samples = samples("Placebo", "Treatment"), method = "LogrankTest") + Statistic(id = "Events Placebo", samples = samples("Placebo"), method = "EventCountStat") + Statistic(id = "Events Treatment", samples = samples("Treatment"), method = "EventCountStat") + Statistic(id = "Patients Placebo", samples = samples("Placebo"), method = "PatientCountStat") + Statistic(id = "Patients Treatment", samples = samples("Treatment"), method = "PatientCountStat")

evaluation.model = EvaluationModel() + Criterion(id = "Marginal power", method = "MarginalPower", tests = tests("Placebo vs treatment"), labels = c("Placebo vs treatment"), par = parameters(alpha = 0.025)) + Criterion(id = "Mean Events", method = "MeanSumm", statistics = statistics("Events Placebo", "Events Treatment"), labels = c("Mean Events Placebo", "Mean Events Treatment")) + Criterion(id = "Mean Patients", method = "MeanSumm", statistics = statistics("Patients Placebo", "Patients Treatment"), labels = c("Mean Patients Placebo", "Mean Patients Treatment"))

sim.parameters = SimParameters(n.sims = 1000, proc.load = "full", seed = 42938001)

data.model = DataModel() + OutcomeDist(outcome.dist = "ExpoDist", outcome.type = "event") + Sample(id = "Placebo", outcome.par = parameters(parameters(rate =0.05))) + Sample(id = "Treatment", outcome.par = parameters(parameters(rate =0.05*0.6))) + SampleSize(1500) + Design(enroll.period = 1, study.duration = 5, enroll.dist = "UniformDist", dropout.dist = "ExpoDist", dropout.dist.par = parameters(rate = 0.0115))

results = CSE(data.model, analysis.model, evaluation.model, sim.parameters)

gpaux commented 4 years ago

Thanks for your feedback! The issue comes from the computation of the one sided log rank test pvalue. I have revised the function 72550e202445fdb63b1666f8490e94d6520c0b3c

ipval6 commented 4 years ago

It seems to work perfectly now. Thank you again for your help!