Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help for sample size calculation for 3 independent groups

    Dear All,

    I am trying for the first time to perform a sample size calculation in a study with 3 different groups in mice: wild type (WT, the control group), heterozygous (HETERO, group 1) and knock out (KO, group 2) for a specific gene expression. The outcome variable is glucose (a continous variable).

    I would like to calculate the sample sizes, looking for any 25% difference between any group.

    The power is 80% and two sided alpha 0.05. I assume a 15% SD in all groups.

    We estimate HETERO to be intermediary between WT and KO, but the experiment would only be powered to detect any difference of 25% (likely WT – KO).

    What is the best way to proceed further and which code would be better?

    I would like to thank you in advance and any help would be much appreciated!

  • #2
    I think this can be done using a simulation but I am not exactly sure of the scenario. What is the expected mean in each group? 25% difference of what? Why is the SD in percent?
    Best wishes

    Stata 18.0 MP | ORCID | Google Scholar

    Comment


    • #3
      Originally posted by Matteo Bargagli View Post
      We estimate HETERO to be intermediary between WT and KO, but the experiment would only be powered to detect any difference of 25% (likely WT – KO).
      Well, the worst case (maximum variance between groups) would be when the intermediary mean, that is, HETERO's mean, is halfway between those for WT and KO, which, with a minimum detectable difference of 25%, will "bookend" the range at 75 and 100%.

      So, perhaps try the following.
      Code:
      version 17.0
      
      clear *
      
      local WT 100
      local KO 75
      
      tempname Means
      matrix define `Means' = `WT', ., `KO'
      
      local MSE = 15^2
      
      frame create Power double het int siz
      
      forvalues Hetero = `KO'/`WT' {
      
          matrix define `Means'[1, 2] = `Hetero'
      
          quietly power oneway `Means', ///
              alpha(0.05) power(0.80) varerror(`MSE')
          frame post Power (`Means'[1, 2]) (r(N))
      }
      
      matrix define `Means'[1, 2] = `KO' + (`WT' - `KO') / 2
      quietly power oneway `Means', alpha(0.05) power(0.80) varerror(`MSE')
      frame post Power (`Means'[1, 2]) (r(N))
      
      cwf Power
      
      graph twoway line siz het, sort lcolor(black) ///
          ytitle(Sample Size) ylabel(21(2)27, angle(horizontal) nogrid) ///
          xtitle(Mean for HETERO Group) ///
          xline(87.5, lcolor(black) lpattern(dash)) text(22 88 "Worst Case", ///
              placement(east))
      graph export "Power Analysis.png"
      
      exit
      Power analysis graph shown below. Sample size is total, that is, for all three equally sized groups.

      Click image for larger version

Name:	Power Analysis.png
Views:	1
Size:	28.4 KB
ID:	1684516

      Comment


      • #4
        Originally posted by Felix Bittmann View Post
        I think this can be done using a simulation but I am not exactly sure of the scenario. What is the expected mean in each group? 25% difference of what? Why is the SD in percent?
        Thank you very much for the answer.
        As the answer below, I do not know the exact mean value for each group, so we can assume 100 with SD 15 (WT), 87.5 with SD 13.13 (HETERO) and 75 with SD 11.25 (KO).
        then the 25% difference is the max difference between the WT and any other group. Possibly the KO.

        Comment


        • #5
          Originally posted by Joseph Coveney View Post
          Well, the worst case (maximum variance between groups) would be when the intermediary mean, that is, HETERO's mean, is halfway between those for WT and KO, which, with a minimum detectable difference of 25%, will "bookend" the range at 75 and 100%.

          So, perhaps try the following.
          Code:
          version 17.0
          
          clear *
          
          local WT 100
          local KO 75
          
          tempname Means
          matrix define `Means' = `WT', ., `KO'
          
          local MSE = 15^2
          
          frame create Power double het int siz
          
          forvalues Hetero = `KO'/`WT' {
          
          matrix define `Means'[1, 2] = `Hetero'
          
          quietly power oneway `Means', ///
          alpha(0.05) power(0.80) varerror(`MSE')
          frame post Power (`Means'[1, 2]) (r(N))
          }
          
          matrix define `Means'[1, 2] = `KO' + (`WT' - `KO') / 2
          quietly power oneway `Means', alpha(0.05) power(0.80) varerror(`MSE')
          frame post Power (`Means'[1, 2]) (r(N))
          
          cwf Power
          
          graph twoway line siz het, sort lcolor(black) ///
          ytitle(Sample Size) ylabel(21(2)27, angle(horizontal) nogrid) ///
          xtitle(Mean for HETERO Group) ///
          xline(87.5, lcolor(black) lpattern(dash)) text(22 88 "Worst Case", ///
          placement(east))
          graph export "Power Analysis.png"
          
          exit
          Power analysis graph shown below. Sample size is total, that is, for all three equally sized groups.

          [ATTACH=CONFIG]n1684516[/ATTACH]
          Thank you a lot!!! This is exactly what I mean.

          The code is quite difficult for my stata user level at the moment.

          Can I ask why you selected the var error as the SD^2? I have red the Stata manual for power oneway but it is not explained how to set the varerror.

          Comment


          • #6
            Originally posted by Matteo Bargagli View Post
            Can I ask why you selected the var error as the SD^2?
            Because I understood that when you said, "I assume a 15% SD in all groups." above that you were referring to the within-group (error) standard deviation. The error variance is the square of that.

            By the way, I mistyped "maximum" when I intended the opposite: read "worst case (minimum variance between groups)".

            Comment


            • #7
              Thank you, so in case I would repeat the same calculation in the future, to obtain the vererror, I need to calculate the square of the absolute standard deviation (within group).

              For example, if my WT group mean value is 80 +- 12 (15% SD) (mean blood glucose level in mg/dL), I would need to use 144 as varerror (12^2).

              Correct?

              Thank you again.

              Comment


              • #8
                Correct.

                Comment

                Working...
                X