Announcement

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

  • Fisher LSD test following MANOVA?

    Hey everyone,

    I'm wondering if there is any way to use Fisher's post hoc LSD test after a MANOVA in stata? I need to run this test for a class but can't find any command language that runs this test. Really don't want to have to jump over to SPSS ;P

    Thanks!

  • #2
    Yes, there's a way: you can use Stata's -pwcompare- after -manova-, specifying the equation(s) as desired. See below for an illustration of the command language:

    The illustration uses the worked example shown in the YouTube video here. The illustration follows along with the SPSS worked example in that video, showing that the analogous results from Stata match those for SPSS at the video's elapsed times noted in the comments below.

    .ÿ
    .ÿversionÿ17.0

    .ÿ
    .ÿclearÿ*

    .ÿ
    .ÿ/*ÿDatasetÿsourceÿ
    >ÿÿÿÿproximalÿhttps://www.randomservices.org/random/data/Cicada.html
    >ÿÿÿÿreferenceÿ"Theÿtableÿbelowÿgivesÿtheÿbodyÿweightÿ(inÿgrams),ÿbodyÿlength,ÿ
    >ÿÿÿÿwingÿlength,ÿwingÿwidthÿ(inÿmillimeters),ÿgenderÿ(0ÿfemale,ÿ1ÿmale),ÿandÿ
    >ÿÿÿÿspeciesÿ(0ÿtredecula,ÿ1ÿtredecassini,ÿ2ÿtredecim)ÿforÿaÿsampleÿofÿ13-yearÿ
    >ÿÿÿÿcicadasÿ(Magicicada)ÿcollectedÿinÿtheÿmiddleÿTennesseeÿarea.ÿTheÿnumberÿ
    >ÿÿÿÿofÿcasesÿisÿ104.ÿSourceÿGingerÿRowellÿandÿRobertÿGrammer,ÿBelmontÿCollege."ÿ*/
    .ÿ
    .ÿimportÿexcelÿ"CicadaÿData.xlsx",ÿsheet(Sheet1)ÿcellrange(A2:G106)ÿfirstrow
    (7ÿvars,ÿ104ÿobs)

    .ÿrenameÿ*,ÿlower

    .ÿ
    .ÿrenameÿgÿsex

    .ÿlabelÿdefineÿSexesÿ0ÿFÿ1ÿM

    .ÿlabelÿvaluesÿsexÿSexes

    .ÿ
    .ÿlabelÿdefineÿSpeciesÿ0ÿTredeculaÿ1ÿTredecassiniÿ2ÿTredecim

    .ÿlabelÿvaluesÿspeciesÿSpecies

    .ÿ
    .ÿ//ÿFollowingÿSPSSÿworkedÿexampleÿhereÿhttps://www.youtube.com/watch?v=YAhZvp8IU4Q
    .ÿmanovaÿbwÿwlÿblÿ=ÿspecies

    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿNumberÿofÿobsÿ=ÿÿÿÿÿÿÿÿ104

    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿWÿ=ÿWilks'ÿlambdaÿÿÿÿÿÿLÿ=ÿLawley-Hotellingÿtrace
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿPÿ=ÿPillai'sÿtraceÿÿÿÿÿRÿ=ÿRoy'sÿlargestÿroot

    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿSourceÿ|ÿStatisticÿÿÿÿÿÿÿÿdfÿÿÿÿF(df1,ÿÿÿÿÿdf2)ÿ=ÿÿÿFÿÿÿProb>F
    ÿÿÿÿÿÿÿÿÿÿ-----------+-------------------------------------------------------
    ÿÿÿÿÿÿÿÿÿÿÿÿÿspeciesÿ|Wÿÿÿ0.7819ÿÿÿÿÿÿÿÿÿ2ÿÿÿÿÿÿ6.0ÿÿÿÿ198.0ÿÿÿÿÿ4.32ÿ0.0004ÿe
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|Pÿÿÿ0.2276ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ6.0ÿÿÿÿ200.0ÿÿÿÿÿ4.28ÿ0.0004ÿa
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|Lÿÿÿ0.2669ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ6.0ÿÿÿÿ196.0ÿÿÿÿÿ4.36ÿ0.0004ÿa
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|Rÿÿÿ0.2091ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ3.0ÿÿÿÿ100.0ÿÿÿÿÿ6.97ÿ0.0003ÿu
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|-------------------------------------------------------
    ÿÿÿÿÿÿÿÿÿÿÿÿResidualÿ|ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ101
    ÿÿÿÿÿÿÿÿÿÿ-----------+-------------------------------------------------------
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿTotalÿ|ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ103
    ÿÿÿÿÿÿÿÿÿÿ-------------------------------------------------------------------
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿeÿ=ÿexact,ÿaÿ=ÿapproximate,ÿuÿ=ÿupperÿboundÿonÿF

    .ÿ
    .ÿ//ÿMatchesÿLSDÿresultsÿforÿBWÿshownÿinÿtableÿatÿ2:43–3:10ÿinÿvideo
    .ÿpwcompareÿspecies,ÿpveffects

    Pairwiseÿcomparisonsÿofÿmarginalÿlinearÿpredictions

    Margins:ÿasbalanced

    -------------------------------------------------------------------
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿUnadjusted
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|ÿÿÿContrastÿÿÿStd.ÿerr.ÿÿÿÿÿÿtÿÿÿÿP>|t|
    ---------------------------+---------------------------------------
    bwÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿspeciesÿ|
    TredecassiniÿvsÿTredeculaÿÿ|ÿÿÿÿÿÿ.0175ÿÿÿ.0118063ÿÿÿÿÿ1.48ÿÿÿ0.141
    ÿÿÿÿTredecimÿvsÿTredeculaÿÿ|ÿÿÿÿÿÿ.0575ÿÿÿ.0252992ÿÿÿÿÿ2.27ÿÿÿ0.025
    ÿTredecimÿvsÿTredecassiniÿÿ|ÿÿÿÿÿÿÿÿ.04ÿÿÿ.0250165ÿÿÿÿÿ1.60ÿÿÿ0.113
    -------------------------------------------------------------------

    .ÿ
    .ÿ//ÿMatchesÿLSDÿresultsÿforÿWLÿshownÿinÿtableÿatÿ5:14–5:56ÿinÿvideo
    .ÿpwcompareÿspecies,ÿpveffectsÿequation(wl)

    Pairwiseÿcomparisonsÿofÿmarginalÿlinearÿpredictions

    Margins:ÿasbalanced

    -------------------------------------------------------------------
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿUnadjusted
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|ÿÿÿContrastÿÿÿStd.ÿerr.ÿÿÿÿÿÿtÿÿÿÿP>|t|
    ---------------------------+---------------------------------------
    wlÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿspeciesÿ|
    TredecassiniÿvsÿTredeculaÿÿ|ÿÿÿ1.188552ÿÿÿ.4466308ÿÿÿÿÿ2.66ÿÿÿ0.009
    ÿÿÿÿTredecimÿvsÿTredeculaÿÿ|ÿÿÿ1.484848ÿÿÿ.9570661ÿÿÿÿÿ1.55ÿÿÿ0.124
    ÿTredecimÿvsÿTredecassiniÿÿ|ÿÿÿ.2962963ÿÿÿ.9463722ÿÿÿÿÿ0.31ÿÿÿ0.755
    -------------------------------------------------------------------

    .ÿ
    .ÿ//ÿConsiderÿalso
    .ÿmatrixÿdefineÿTredeculavTredecassiniÿ=ÿ(1,ÿ-1,ÿ0,ÿ0)

    .ÿmanovatestÿ,ÿtest(TredeculavTredecassini)

    ÿTestÿconstraint
    ÿ(1)ÿÿÿÿ0.speciesÿ-ÿ1.speciesÿ=ÿ0

    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿWÿ=ÿWilks'ÿlambdaÿÿÿÿÿÿLÿ=ÿLawley-Hotellingÿtrace
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿPÿ=ÿPillai'sÿtraceÿÿÿÿÿRÿ=ÿRoy'sÿlargestÿroot

    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿSourceÿ|ÿStatisticÿÿÿÿÿÿÿÿdfÿÿÿÿF(df1,ÿÿÿÿÿdf2)ÿ=ÿÿÿFÿÿÿProb>F
    ÿÿÿÿÿÿÿÿÿÿ-----------+-------------------------------------------------------
    ÿÿÿÿÿÿÿÿÿÿmanovatestÿ|Wÿÿÿ0.9319ÿÿÿÿÿÿÿÿÿ1ÿÿÿÿÿÿ3.0ÿÿÿÿÿ99.0ÿÿÿÿÿ2.41ÿ0.0714ÿe
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|Pÿÿÿ0.0681ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ3.0ÿÿÿÿÿ99.0ÿÿÿÿÿ2.41ÿ0.0714ÿe
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|Lÿÿÿ0.0731ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ3.0ÿÿÿÿÿ99.0ÿÿÿÿÿ2.41ÿ0.0714ÿe
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|Rÿÿÿ0.0731ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ3.0ÿÿÿÿÿ99.0ÿÿÿÿÿ2.41ÿ0.0714ÿe
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|-------------------------------------------------------
    ÿÿÿÿÿÿÿÿÿÿÿÿResidualÿ|ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ101
    ÿÿÿÿÿÿÿÿÿÿ-------------------------------------------------------------------
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿeÿ=ÿexact,ÿaÿ=ÿapproximate,ÿuÿ=ÿupperÿboundÿonÿF

    .ÿ/*ÿcf.ÿhotellingÿbwÿwlÿblÿifÿinlist(species,ÿ"Tredecula":Species,ÿ"Tredecassini":Species),ÿby(species)ÿnotableÿ*/
    .ÿ
    .ÿmatrixÿdefineÿTredeculavTredecimÿ=ÿ(1,ÿ0,ÿ-1,ÿ0)

    .ÿmanovatestÿ,ÿtest(TredeculavTredecim)

    ÿTestÿconstraint
    ÿ(1)ÿÿÿÿ0.speciesÿ-ÿ2.speciesÿ=ÿ0

    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿWÿ=ÿWilks'ÿlambdaÿÿÿÿÿÿLÿ=ÿLawley-Hotellingÿtrace
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿPÿ=ÿPillai'sÿtraceÿÿÿÿÿRÿ=ÿRoy'sÿlargestÿroot

    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿSourceÿ|ÿStatisticÿÿÿÿÿÿÿÿdfÿÿÿÿF(df1,ÿÿÿÿÿdf2)ÿ=ÿÿÿFÿÿÿProb>F
    ÿÿÿÿÿÿÿÿÿÿ-----------+-------------------------------------------------------
    ÿÿÿÿÿÿÿÿÿÿmanovatestÿ|Wÿÿÿ0.8275ÿÿÿÿÿÿÿÿÿ1ÿÿÿÿÿÿ3.0ÿÿÿÿÿ99.0ÿÿÿÿÿ6.88ÿ0.0003ÿe
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|Pÿÿÿ0.1725ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ3.0ÿÿÿÿÿ99.0ÿÿÿÿÿ6.88ÿ0.0003ÿe
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|Lÿÿÿ0.2085ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ3.0ÿÿÿÿÿ99.0ÿÿÿÿÿ6.88ÿ0.0003ÿe
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|Rÿÿÿ0.2085ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ3.0ÿÿÿÿÿ99.0ÿÿÿÿÿ6.88ÿ0.0003ÿe
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|-------------------------------------------------------
    ÿÿÿÿÿÿÿÿÿÿÿÿResidualÿ|ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ101
    ÿÿÿÿÿÿÿÿÿÿ-------------------------------------------------------------------
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿeÿ=ÿexact,ÿaÿ=ÿapproximate,ÿuÿ=ÿupperÿboundÿonÿF

    .ÿ/*ÿcf.ÿhotellingÿbwÿwlÿblÿifÿinlist(species,ÿ"Tredecula":Species,ÿ"Tredecim":Species),ÿby(species)ÿnotableÿ*/
    .ÿ
    .ÿmatrixÿdefineÿTredecassinivTredecimÿ=ÿ(0,ÿ1,ÿ-1,ÿ0)

    .ÿmanovatestÿ,ÿtest(TredecassinivTredecim)

    ÿTestÿconstraint
    ÿ(1)ÿÿÿÿ1.speciesÿ-ÿ2.speciesÿ=ÿ0

    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿWÿ=ÿWilks'ÿlambdaÿÿÿÿÿÿLÿ=ÿLawley-Hotellingÿtrace
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿPÿ=ÿPillai'sÿtraceÿÿÿÿÿRÿ=ÿRoy'sÿlargestÿroot

    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿSourceÿ|ÿStatisticÿÿÿÿÿÿÿÿdfÿÿÿÿF(df1,ÿÿÿÿÿdf2)ÿ=ÿÿÿFÿÿÿProb>F
    ÿÿÿÿÿÿÿÿÿÿ-----------+-------------------------------------------------------
    ÿÿÿÿÿÿÿÿÿÿmanovatestÿ|Wÿÿÿ0.8550ÿÿÿÿÿÿÿÿÿ1ÿÿÿÿÿÿ3.0ÿÿÿÿÿ99.0ÿÿÿÿÿ5.60ÿ0.0014ÿe
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|Pÿÿÿ0.1450ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ3.0ÿÿÿÿÿ99.0ÿÿÿÿÿ5.60ÿ0.0014ÿe
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|Lÿÿÿ0.1696ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ3.0ÿÿÿÿÿ99.0ÿÿÿÿÿ5.60ÿ0.0014ÿe
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|Rÿÿÿ0.1696ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ3.0ÿÿÿÿÿ99.0ÿÿÿÿÿ5.60ÿ0.0014ÿe
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ|-------------------------------------------------------
    ÿÿÿÿÿÿÿÿÿÿÿÿResidualÿ|ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ101
    ÿÿÿÿÿÿÿÿÿÿ-------------------------------------------------------------------
    ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿeÿ=ÿexact,ÿaÿ=ÿapproximate,ÿuÿ=ÿupperÿboundÿonÿF

    .ÿ/*ÿcf.ÿhotellingÿbwÿwlÿblÿifÿinlist(species,ÿ"Tredecassini":Species,ÿ"Tredecim":Species),ÿby(species)ÿnotableÿ*/
    .ÿ
    .ÿexit

    endÿofÿdo-file


    .

    Comment


    • #3
      Thank you!

      Comment

      Working...
      X