Announcement

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

  • Sample size calculation for repeated measures using ancova

    Hi,

    I am looking to repeat the power calculation found in this protocol (sample size text attached): https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4950103/

    The trial is a 2 group, 2 measure study (baseline & follow-up), comparing change in a biomarker (HbA1c). The estimated clinically relevant difference is 0.5%, with a cross-sectional SD of 1.1 and correlation of 0.4. The power is set to 90%.

    I try to repeat this using the following:

    Code:
    power repeated 0 0 \ 0 0.5, factor(bwithin) corr(0.4) varerror(1.21) power(0.9)
    But I think I am misunderstanding something as my results differ. Does anyone have advice on how to perform this calculation?

    Thank you very much,
    Megan


    Click image for larger version

Name:	samplesize.PNG
Views:	1
Size:	62.7 KB
ID:	1578399

  • #2
    Originally posted by Megan Moreton View Post
    . . . I think I am misunderstanding something as my results differ. Does anyone have advice on how to perform this calculation?
    Your sample-size estimation command is for repeated-measures ANOVA. According to the excerpt that you've copied and pasted, they're not using a repeated-measures ANOVA, but rather an ANCOVA.

    Here's my take on what they did. (non is the nonpregnant-patient cohort and prg is the pregnant-patient cohort, which as implied in the abstract at the URL that you posted are randomized separately to the two treatment groups.)

    .ÿ
    .ÿversionÿ16.1

    .ÿ
    .ÿclearÿ*

    .ÿ
    .ÿsetÿseedÿ`=strreverse("1578398")'

    .ÿ
    .ÿprogramÿdefineÿsimem,ÿrclass
    ÿÿ1.ÿÿÿÿÿversionÿ16.1
    ÿÿ2.ÿÿÿÿÿsyntaxÿ,ÿn1(integer)ÿn2(integer)
    ÿÿ3.ÿ
    .ÿÿÿÿÿdropÿ_all
    ÿÿ4.ÿ
    .ÿÿÿÿÿ//ÿNonpregnantÿpatients
    .ÿÿÿÿÿdrawnormÿout0ÿout1,ÿdoubleÿcorr(1ÿ0.4ÿ\ÿ0.4ÿ1)ÿ///
    >ÿÿÿÿÿÿÿÿÿsd(0.8ÿ0.8)ÿn(`n1')
    ÿÿ5.ÿÿÿÿÿgenerateÿbyteÿtrtÿ=ÿmod(_n,ÿ2)
    ÿÿ6.ÿÿÿÿÿreplaceÿout1ÿ=ÿout1ÿ-ÿ0.5ÿ*ÿtrt
    ÿÿ7.ÿ
    .ÿÿÿÿÿanovaÿout1ÿi.trtÿc.out0
    ÿÿ8.ÿÿÿÿÿtestÿ1.trt
    ÿÿ9.ÿÿÿÿÿtempnameÿnon
    ÿ10.ÿÿÿÿÿscalarÿdefineÿ`non'ÿ=ÿr(p)ÿ<ÿ0.05
    ÿ11.ÿ
    .ÿÿÿÿÿ//ÿPregnantÿpatients
    .ÿÿÿÿÿdropÿ_all
    ÿ12.ÿÿÿÿÿdrawnormÿout0ÿout1,ÿdoubleÿcorr(1ÿ0.4ÿ\ÿ0.4ÿ1)ÿ///
    >ÿÿÿÿÿÿÿÿÿsd(1.1ÿ1.1)ÿn(`n2')
    ÿ13.ÿÿÿÿÿgenerateÿbyteÿtrtÿ=ÿmod(_n,ÿ2)
    ÿ14.ÿÿÿÿÿreplaceÿout1ÿ=ÿout1ÿ-ÿ0.5ÿ*ÿtrt
    ÿ15.ÿ
    .ÿÿÿÿÿanovaÿout1ÿi.trtÿc.out0ÿ
    ÿ16.ÿÿÿÿÿtestÿ1.trt
    ÿ17.ÿÿÿÿÿreturnÿscalarÿprgÿ=ÿr(p)ÿ<ÿ0.05
    ÿ18.ÿÿÿÿÿreturnÿscalarÿnonÿ=ÿ`non'
    ÿ19.ÿend

    .ÿ
    .ÿlocalÿn1ÿ=ÿround(110ÿ-ÿ0.15ÿ*ÿ110,ÿ2)ÿ//ÿ15%ÿattritionÿinÿnonpregnantÿpatients

    .ÿlocalÿn2ÿ=ÿround(214ÿ-ÿ0.20ÿ*ÿ214,ÿ2)ÿ//ÿ20%ÿattritionÿinÿpregnantÿpatients

    .ÿdisplayÿinÿsmclÿasÿtextÿ"Sampleÿsizeÿafterÿattritionÿ=ÿ"ÿ///
    >ÿÿÿÿÿasÿresultÿ`n1',ÿ`n2'ÿasÿtextÿ"ÿ(even-numberedÿinÿorderÿtoÿallowÿrandomization)"
    Sampleÿsizeÿafterÿattritionÿ=ÿ94ÿ172ÿ(even-numberedÿinÿorderÿtoÿallowÿrandomization)

    .ÿ
    .ÿquietlyÿsimulateÿnonÿ=ÿr(non)ÿprgÿ=ÿr(prg),ÿreps(300)ÿnodots:ÿsimemÿ,ÿ///
    >ÿÿÿÿÿn1(`n1')ÿn2(`n2')

    .ÿ
    .ÿforeachÿvarÿofÿvarlistÿnonÿprgÿ{
    ÿÿ2.ÿÿÿÿÿsummarizeÿ`var',ÿmeanonly
    ÿÿ3.ÿÿÿÿÿdisplayÿinÿsmclÿasÿtextÿ"Powerÿ(`var')ÿ=ÿ"ÿasÿresultÿ%04.2fÿr(mean)
    ÿÿ4.ÿ}
    Powerÿ(non)ÿ=ÿ0.89
    Powerÿ(prg)ÿ=ÿ0.90

    .ÿ
    .ÿexit

    endÿofÿdo-file


    .


    I tend to use simulation instead of canned procedures—it helps make sure that when the time comes I understand how to set up the primary analysis and that the method of analysis is feasible.

    Comment


    • #3
      This is amazingly helpful - thank you very much for your time & assistance

      Comment

      Working...
      X