Dear Listers,
I am estimating the necessary sample size for a non-inferiority trial for weight loss comparing a new treatment to a more standard one (control). We are assuming equivalent weight in the two study arms at baseline and setting the non-inferiority margin to 6, based on existing data.
I developed a do file to simulate the data and estimate the required sample size. The script seems to produce a sensible estimate based on an estimated sample using the standard formula; yet I wanted to double-check the script is OK. Should I build more variability around the delta?
I read that the sample size can be adjusted to take into account the correlation between baseline and follow-up scores, so I am also using the simulations to estimate the correlation between those. I'd be inclined to use the mean value as it is in line with other studies in the area... however, I was also wondering if there is a way to simulate the data by specifying an expected correlation; for example 80%.
Any advice welcome!
I am estimating the necessary sample size for a non-inferiority trial for weight loss comparing a new treatment to a more standard one (control). We are assuming equivalent weight in the two study arms at baseline and setting the non-inferiority margin to 6, based on existing data.
I developed a do file to simulate the data and estimate the required sample size. The script seems to produce a sensible estimate based on an estimated sample using the standard formula; yet I wanted to double-check the script is OK. Should I build more variability around the delta?
I read that the sample size can be adjusted to take into account the correlation between baseline and follow-up scores, so I am also using the simulations to estimate the correlation between those. I'd be inclined to use the mean value as it is in line with other studies in the area... however, I was also wondering if there is a way to simulate the data by specifying an expected correlation; for example 80%.
Any advice welcome!
Code:
/* Script to estimate sample size needed for a 2-arm RCT on weight loss New treatment vs. standard treatment (i.e. control) assessing non-inferiority Weight measurement at baseline and follow-up to be analysed using ANCOVA we assume same mean and sd for weight at baseline delta1 = weight reduction in intervention delta2 = weight reduction in control m2 = non-inferiority margin */ clear clear all capture program drop sinem set seed 679832567 program define sinem, rclass version 17.0 syntax, [n(integer 1) sd(real 1) base(real 1) delta1(real 1) delta2(real 1) /// m2(real 1) noBALance] drop _all //Participants if "`balance'"!= "" local N `n' else local N=`n'- mod(`n', 2) set obs `N' g long pid = _n generate byte trt = mod(_n, 2) *Outcomes, baseline (out0) and follow-up (out1) g double out0 = rnormal(`base', `sd') g double out1 = rnormal(out0+cond(trt, `delta1', `delta2') ,`sd') corr out1 out0 tempname c_rho scalar define `c_rho' = r(rho) * ANCOVA regress out1 i.trt c.out0 mat list r(table) matrix row1 = r(table) tempname yes scalar define `yes' = `m2'< row1[5,2] return scalar yes= `yes' return scalar c_rho = `c_rho' end simulate powers=r(yes) crho=r(c_rho), reps(1000) seed(2345): sinem, n(520) base(108) delta1(-12) delta2(-12) sd(21) m2(-6) tab powers sum crho *** Adjustment for correlation - using mean rho value di 520*(1-.70^2)
Comment