Announcement

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

  • Power calculations for mixed effects model

    Hi there,

    I am a PhD-student at the University of Southern Denmark, and I am hoping, that you can help me write the Stata code for a mixed effects power analysis.

    In my project we want to examine if long-duration endurance performance (durability) is influenced by muscle glycogen levels.
    To investigate this, we will utilize a randomized crossover design, where our subjects will report to the laboratory twice:
    1. On the first visit, the subjects will complete a short 30-min warm-up followed by a 20-min all-out time-trial (fresh state).
    2. On the second visit, the subjects will complete 4 hours of moderate intensity exercise with intermittent sprints, followed by another 20-min all-out time-trial (fatigued state).
    Muscle biopsies will be taken before each 20-minute time trial.

    Our expected values based on pilot testing and similar studies:

    Power, fresh state: 350 watts (SD = 30 watts)
    Power, fatigued state: 320 watts (SD = 30 watts)

    Glycogen, fresh state: 700 mmol / kg. dry weight (SD = 75)
    Glycogen, fatigues state: 200 mmol / kg. dry weight (SD = 75)

    I was told by a biostatistician at our campus, that I should do a "matched case crossover mixed model". I have tried to read up on this to see if I could make the analysis in Stata, but I don't have any experience with mixed models, so I haven't had any success.

    Can anyone help me write the Stata code for such a calculation?

    Thanks a lot.

    - Anders.

  • #2
    Originally posted by Anders Aagaard Hansen View Post
    Can anyone help me write the Stata code for such a calculation?
    You'll probably want to pursue your power analysis via simulation, perhaps something along the lines of that below.

    I don't recall ever seeing the expressions "matched case" and "crossover mixed model" used together, and so I'm not entirely certain what your campus biostatistician was referring to. But I guess that it would be assessing the association between "durability" as the response variable and starting glycogen level as the predictor in a longitudinal model. Because the fresh- versus fatigued-state pretreatment condition is confounded with visit (laboratory session) in your one-way crossover study design, your regression model would have only the visit factor variable as the predictor (in addition to starting glycogen level as a continuous predictor).

    In the simulation below, I've made it possible for the degree of association to differ between the two pretreatment conditions by adding a term for visit × starting glycogen-level interaction to the regression model.

    The complete do-file and its output (log file) are attached if you want to pursue this avenue further.
    Code:
    version 18.0
    
    clear *
    
    // seedem
    set seed 1843274384
    
    program define simEm, rclass
        version 18.0
        syntax , [n(integer 50) Slope(real 0) Interaction(real 0) Rho(real 0.5)]
    
        // Data-generating process
        drop _all
    
        drawnorm e0 e1, double sd(30 30) corr(1 `rho' \ `rho' 1) n(`n')
        drawnorm gly0 gly1, double mean(700 200) sd(75 75)
        
        generate long pid = _n
        reshape long e gly, i(pid) j(vis)
    
        generate double pow = 350 -               /// intercept
            30 * vis +                            /// pretreatment condition (fresh or fatigued)
            `slope' * gly +                       /// glycogen level
            `interaction' * `slope' * vis * gly + /// pretreatment-condition × glycogen-level interaction
                e                                 /// correlated error term
    
        // One-way crossover regression model
        xtreg pow i.vis##c.gly, i(pid) re
        return scalar gly = r(table)["pvalue", "gly"]
        return scalar iac = r(table)["pvalue", "1.vis#gly"]
    end
    
    program define summarizEm
        version 18.0
        syntax anything
    
        assert !missing(gly, iac)
        foreach var of varlist gly iac {
            generate byte pos_`var' = `var' < 0.05
            summarize pos_`var', meanonly
            display in smcl as text "`anything' for `var' = " as result %03.2f r(mean)
        }
    end
    
    *
    * Test size (null hypothesis is true)
    *
    quietly simulate gly = r(gly) iac = r(iac), reps(1000): simEm
    summarizEm Test size
    
    *
    * Power (alternative hypothesis is slope = 0.15; no interaction)
    *
    forvalues n = 25(25)75 {
        quietly simulate gly = r(gly) iac = r(iac), reps(400): simEm , n(`n') s(0.15)
        display in smcl as text _newline(1) "N = `n'"
        summarizEm Power
    }
    
    exit
    I'm a little curious about your research question: "if long-duration endurance performance (durability) is influenced by muscle glycogen levels". Within the same person I would've taken the "durability" value to be basically a surrogate measure of starting glycogen level, that is, both reflect the same exercise-physiology status. Is this a method-validation study?
    Attached Files

    Comment

    Working...
    X