Announcement

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

  • Anova Repeated Measures and post-hoc and R2 low

    Good morning to everybody i have tu run an Anova Repeated Measures with the outcome (LR, HR-no diagnosis, and HR-NDD infants) as factor and age (10 days and 6, 12, 18, and 24 weeks) as the repeated measures.

    i wrote the code below
    HTML Code:
    anova y diagnosis##timepoint, repeated(timepoint) bseunit(id) bse(Diagnosi_num

    for the post hoc comparison i use the code below

    HTML Code:
    margins Diagnosi##timepoint, pwcompare(effects) mcompare(bonferroni)

    When I run the model I get a very low R2. So I have to ask you: 1) Is the written syntax correct? 2) can I accept the results of the model with an R2 of 0.08 and therefore the post-hoc results? 3) if the syntax is wrong, what is the right one please? Thanks a million in advance

    Tommaso Salvitti

  • #2
    Originally posted by Tommaso Salvitti View Post
    1) Is the written syntax correct?
    For the regression model, it's not the syntax to fit a conventional repeated-measures ANOVA model. For the postesimation command, you're making all pairwise comparisons, most of which probably aren't of any import to your research objective (which you don't state by the way—that would go a long way toward formulating cogent, focused individual comparisons instead of the shotgun approach shown).

    2) can I accept the results of the model with an R2 of 0.08 and therefore the post-hoc results?
    Do you have a choice? If you intended to address the question that that regression model implies, then what you get is what you get. The alternative is to go back and consider alternative outcomes (and perhaps study designs) with greater consideration for measurement error. (You don't seem to have an intervention, and so I guess that it's just a longitudinal observation study.)

    3) if the syntax is wrong, what is the right one please?
    With no other information to go on, I'd suggest something like the following. (Variable names shortened. Begin at the "Begin here" comment.)
    Code:
    version 18.0
    
    clear *
    
    // seedem
    set seed 2044311468
    
    quietly set obs 21
    generate byte pid = _n
    generate double pid_u = rnormal()
    
    generate byte dgn = mod(_n, 3)
    label define Diagnoses 0 "Low-risk" 1 "High-risk, negative for NDD" ///
        2 "High-risk, Neurodevelopmental Delay"
    label values dgn Diagnoses
    
    quietly expand 5
    bysort pid: generate int tim = _n - 1
    foreach time in 1/4 {
        quietly replace tim = tim * 6 * 7
    }
    quietly replace tim = 10 if !tim
    label define Intervals 10 "10 d" 42 "6 w" 84 "12 w" 126 "18 w" 168 "24 w"
    label values tim Intervals
    
    generate double out = rnormal(pid_u, 1)
    
    *
    * Begin here
    *
    anova out dgn / pid|dgn tim dgn#tim, repeated(tim)
    
    margins dgn#tim, noestimcheck
    marginsplot , ///
        xdim(tim) scheme(s2color) title("") ///
        plotopts(lcolor(black) mcolor(black) mfcolor(white)) ///
            plot1opts(msymbol(O)) ///
            plot2opts(msymbol(T) msize(medlarge)) ///
            plot3opts(msymbol(S)) ///
        noci ///
        ytitle(Outcome Measure) ylabel( , angle(horizontal) nogrid) ///
        xtitle(Observation Interval) xlabel( , valuelabel) ///
        legend(off)
    
    exit
    I don't show any error bars on the graph, which is a so-called profile plot whose purpose is to reveal differences in the pattern of the time course of the outcome between the three groups.

    Comment


    • #3
      Thanks Joseph Coveney
      If I use your code I cannot test The effect of time at each treatment (in my case the treatment is the diagnosis) and The effect of diagnosis at each time. Anyway thanks a lot

      Comment


      • #4
        Originally posted by Tommaso Salvitti View Post
        Thanks Joseph Coveney
        If I use your code I cannot test The effect of time at each treatment (in my case the treatment is the diagnosis) and The effect of diagnosis at each time. Anyway thanks a lot
        Have you tried something like this?
        Code:
        margins tim@dgn, contrast
        For more info and examples, see: https://www.stata.com/manuals/rmargi...rgins,contrast
        --
        Bruce Weaver
        Email: [email protected]
        Version: Stata/MP 18.5 (Windows)

        Comment

        Working...
        X