+ "markdown": "---\ntitle: \"Sample size for superiority studies\"\n---\n\n\n\n### **Introduction about sample size calculations**\n\nFor determination of the sample size, in most cases, all of the below parameters will be required to perform the calculations:\n\n- Power\n\n- clinically relevant/significant difference\n\n- alpha (α)\n\n- beta (β)\n\n- Effect size (Cohen's d) (required only in some R packages), can be defined as:\n\n Difference between the means divided by the pooled standard deviation. In general, 0.2 can be considered a small effect, 0.5 a medium effect and 0.8 a large effect.\n\n\n\n\n\n\n\n### Superiority studies {.unnumbered}\n\nSuperiority trials aim to prove that the investigated treatment is better than the comparator. The null hypothesis states that is no difference between the treatments and the alternative that there is some difference between the treatments (difference ≠ 0).\n\n#### Calculations in R {.unnumbered}\n\nCan be performed in 3 packages in R: **samplesize**, **stats** and **pwr**.\n\n### Comparing means for parallel design (unpaired) {.unnumbered}\n\nIn the most common scenario SDs are known and the same. Otherwise Student t distribution is used instead of the normal distribution. Then approach between SAS and R is different - SAS follows only the Satterthwaite method, whilst in R both, Satterthwaiteand Welch one are available. The results differ slightly.\n\nPrimarily, we will consider the case with the same SDs.\n\n#### Example {.unnumbered}\n\nA client is interested in conducting a clinical trial to compare two cholesterol lowering agents for treatment of hypercholesterolemic patients. The primary efficacy parameter is a low-density lipidprotein cholesterol (LDL-C). Suppose that a difference of 8% in the percent change of LDL-C is considered a clinically meaningful difference and that the standard deviation is assumed to be 15%. What sample size is required for a two-sided false positive rate of 5% and a power of 80%?\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# samplesize:\nn.ttest(power = 0.8, alpha = 0.05, mean.diff = 8, sd1 = 15,\n k = 1, design = \"unpaired\", fraction = \"balanced\", variance = \"equal\")\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n$`Total sample size`\n[1] 114\n\n$`Sample size group 1`\n[1] 57\n\n$`Sample size group 2`\n[1] 57\n```\n\n\n:::\n\n```{.r .cell-code}\n#stats:\npower.t.test(delta=8, sd=15, sig.level=0.05, power=0.8, \n type=\"two.sample\", alternative=\"two.sided\")\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n\n Two-sample t test power calculation \n\n n = 56.16413\n delta = 8\n sd = 15\n sig.level = 0.05\n power = 0.8\n alternative = two.sided\n\nNOTE: n is number in *each* group\n```\n\n\n:::\n\n```{.r .cell-code}\n#pwr:\npwr.t.test(d = 8/15, sig.level = 0.05, power = 0.80, \n type = \"two.sample\", alternative = \"two.sided\")\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n\n Two-sample t test power calculation \n\n n = 56.164\n d = 0.5333333\n sig.level = 0.05\n power = 0.8\n alternative = two.sided\n\nNOTE: n is number in *each* group\n```\n\n\n:::\n:::\n\n\n\n### Comparing means for crossover design (paired) {.unnumbered}\n\nIt is important to differenciate here between the within patient SD and the SD of the difference. We may need to recalculate one to the other, depending on the case.\n\nVariance of the difference = 2x Variance within patient. $$Var_{diff} = 2 * Var_{patient}$$\n\n#### Example\n\nWe wish to run an AB/BA single dose crossover to compare two brochodilators. The primary outcome is peak expiratory flow, and a clinically relevant difference of 30 l/min is sought with 80% power, the significance level is 5% and the best estimate of the within patient standard deviation is 32 l/min. What size of trial do we require?\n\n(After recalculating: $$32 * \\sqrt{2} = 45$$)\n\n\n\n::: {.cell}\n\n```{.r .cell-code}\n# samplesize:\nn.ttest(power = 0.8, alpha = 0.05, mean.diff = 30, sd1 = 45,\n k = 1, design = \"paired\", fraction = \"balanced\")\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n$`Total sample size`\n[1] 20\n```\n\n\n:::\n\n```{.r .cell-code}\n#stats:\npower.t.test(delta=30, sd=45, sig.level=0.05, power=0.8, \n type=\"one.sample\", alternative=\"two.sided\")\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n\n One-sample t test power calculation \n\n n = 19.66697\n delta = 30\n sd = 45\n sig.level = 0.05\n power = 0.8\n alternative = two.sided\n```\n\n\n:::\n\n```{.r .cell-code}\n#pwr:\npwr.t.test(d = 30/45, sig.level = 0.05, power = 0.80, \n type = \"one.sample\", alternative = \"two.sided\")\n```\n\n::: {.cell-output .cell-output-stdout}\n\n```\n\n One-sample t test power calculation \n\n n = 19.66695\n d = 0.6666667\n sig.level = 0.05\n power = 0.8\n alternative = two.sided\n```\n\n\n:::\n:::\n\n\n\n#### References {.unnumbered}\n\nMajority of the examples are taken from: *Chow SC, Liu JP (1998). Design and analysis of clinical trials. Concepts and methodologies. Wiley, New York.*\n",
0 commit comments