repeated measures anova/glm multivariate anova .repeated measures anova/glm multivariate anova/glm

Download Repeated Measures ANOVA/GLM Multivariate ANOVA .Repeated Measures ANOVA/GLM Multivariate ANOVA/GLM

Post on 28-Jul-2018

257 views

Category:

Documents

6 download

Embed Size (px)

TRANSCRIPT

  • RepeatedMeasuresANOVA/GLMMultivariateANOVA/GLM

    inPROCMIXED

    MultivariateMethodsinEducationERSH8350

    Lecture#8 October5,2011

    ERSH8350:Lecture8

  • TodaysClass

    UsingPROCMIXEDfor: Repeatedmeasuresversionsoflinearmodels MultivariateANOVA

    GeneralLinearMixedModels

    AdditionalMIXEDMODELStopics Typesofestimators:MLversusREML

    ERSH8350:Lecture8 2

  • ExampleData Ahealthresearcherisinterestedinexaminingtheimpactof

    dietaryhabitsandexerciseonpulserate Asampleof18participantsiscollected

    Dietfactor(BETWEENSUBJECTS): Ninearevegetarians Nineareomnivores

    Exercisefactor(BETWEENSUBJECTS)withrandomassignment: Aerobicstairclimbing Racquetball Weighttraining

    Threepulserates(WITHINSUBJECTS): Afterwarmup Afterjogging Afterrunning

    ERSH8350:Lecture8 3

  • TheData

    Afirststepineveryanalysisistoinspectthedata Graphicalplotshelp

    Thegoaloftheinspectionistomakesuredataareenteredcorrectly Rightnowwewillnotbeconcernedaboutcheckingassumptions Assumptionsdependonthechoiceofstatisticalmodel

    Wewillnevercleanourdata Butwewillmakesuredataareenteredcorrectly

    ERSH8350:Lecture8 4

  • ERSH8350:Lecture8

    Plots

    Pulse1 Pulse2

    Pulse3

    SquaredMahalanobisDistance

    5

  • MULTIVARIATEDATAANALYSIS:INITIALCONSIDERATIONS

    ERSH8350:Lecture8 6

  • AnInitialLookatOurData

    Thedataforouranalysispresentseveralfactorswhichweareinterestedininvestigating: WithinSubjects:

    Effectsoftimeofmeasurementonpulserate

    BetweenSubjects: Maineffectofdietonpulserate Maineffectofexercisetypeonpulserate Interactionofdietandexercisetypeonpulserate(2way)

    WithinandBetweenInteractions Interactionofmeasurementanddiet(2way) Interactionofmeasurementandexercisetype(2way) Interactionofmeasurement,diet,andexercisetype(3way)

    ERSH8350:Lecture8 7

  • UnderstandingDataforMixedModels

    Thedatasetupformixedmodelsisthatofasetofdependentvariablesnestedwithinanobservation: Forourexample,wehadthreepulseratemeasurements(withinsubjectsfactor)heredisplayedinwideformat

    , , ,

    Wewillconsiderdatathatarestacked:,,,

    Inthemixedmodel,thestackeddataobservation(here,pulse)istreatedasbeingmultivariatenormal

    ERSH8350:Lecture8 8

  • StackingOurData

    Ourfirsttwoobservations(wideformat):

    Ourfirsttwoobservations(long/stackedformat):

    ERSH8350:Lecture8 9

  • LinearMixedModelswithMatrices Thelinearmodelforasingleobservationi:

    pmeasuredoutcomevariables k predictors

    Theequationabovecanbeexpressedmorecompactlybyasetofmatrices

    isofsize(p x1) isofsize(p x(1+k)) isofsize((1+k)x1) calledfixedeffects

    Nextweekwewilladdtothis randomcomponents Themixedmodelismixedbecauseithasfixedandrandomeffects

    isofsize(p x1)ERSH8350:Lecture8 10

  • UnpackingtheEquation

    Forthefirstmeasurementofthefirstobservation:

    ERSH8350:Lecture8 11

  • TheMixedModelforOurData

    Toputthemixedmodelintocontext,letslookatourdata Herewewilluseadummycodedsetofindicatorsforwhichpulse

    measureisinthedata Threemeasuresmakestwodummycodedcolumnsin :oneforpulse#1andoneforpulse#2(pulse#3isnowthereference)

    Theinterceptwillbethemeanofpulse#3 Thefirstregressioncoefficientwillbethedifferencebetweenpulse#3andpulse#1 Thesecondregressioncoefficientwillbethedifferencebetweenpulse#3andpulse#2

    Thefirstobservation:

    ERSH8350:Lecture8 12

  • MixedModelAssumptions

    Themixedmodelassumesallmeasurementsfromasubjectfollowamultivariatenormaldistribution:

    ,

    Additionally,thereareassumptionsabouterror~ ,

    Today,withoutrandomeffects,wetake Nextweek willbeafunctionofrandomeffectvariancesand

    Thesubscriptoneach and indicatesthateachsubjectcanhaveadifferentcovariancestructure Wesawthisforsubjectsmissingdatalastweek

    ERSH8350:Lecture8 13

  • TwoSidesofaMixedModel

    MODELFORTHEMEANS(FIXEDEFFECTS): Themodelforthemeanscomesfromthefixedeffects IVs andlinearmodelweights providepredictedvaluesforeachobservation

    MODELFORTHEVARIANCES(RESIDUALVARIANCESANDRANDOMEFFECTS): Becausewehaverepeatedobservations,themodelforthevariancesisnowacovariancematrixofsizepxp Diagonalelements: varianceoferrorforeachoutcome Offdiagonalelements: covarianceoferrorsforpairsofoutcomes

    ERSH8350:Lecture8 14

  • AnInitialMixedModel Asaguidetounderstandingmixedmodels,wewillestimatea

    modelthatwasdemonstratedonslide12 Dummycodedvariableforpulsemeasurement

    Inthismodelweare: Usingmaximumlikelihood

    Biasedestimatesof covariancematrix(butefficient) Estimatinganunstructured covariancematrix

    ModelforthevarianceswillproducetheMLestimatedcovariancematrix

    Estimatingaverysimplisticmodelforthemeans Replicatesthewithinsubjectsfactor Hypothesistestsforintensitywilltestwhethermeanpulseaftereachtypeofexerciseintensityareequal

    ERSH8350:Lecture8 15

  • InitialModelResults

    MeanforPulse#3= 189.56 MeanforPulse#1= 189.56 102.06 87.50 MeanforPulse#2= 189.56 55.44 134.11

    ERSH8350:Lecture8 16

  • PuttingResultsintoEquations

    Fromourresults,thepredictionsforthefirstobservation:

    Fromthis,wecanseehowthedummycodedindependentvariables makespredictionsabouteachofthemeasurementsinastackedvariable Eachsubjecthasthesamepredictionfortheirpulsevalues

    AsinANOVA

    ERSH8350:Lecture8 17

  • MovingontoErrorCovarianceMatrix

    Themodelforthemeansiswheremostinferencesaremadeinmixedmodels

    However,thekeytotheinferencesinmixedmodelsistheerrorcovariancematrix structure Wrongcovariancematrixstructure=inaccuratestandarderrorsforfixedeffects=inaccuratepvaluesforfixedeffects

    Wefitanunstructuredmatrix (analogoustoMANOVA)

    ERSH8350:Lecture8 18

  • ThreeStructuresofClassicalGLM Threestructures:1. Independence(TYPE=VC):

    Modelsifallobservationsasiftheycamefromseparatepeople NomorestatisticalparametersthanoriginalGLMapproach Dontuse:shownforbaselinepurposes

    2. RepeatedMeasures(TYPE=CS):Assumessphericityofobservations Sphericityisaconditionthatismorestrictlyenforcedbycompoundsymmetry

    of havingtwoparameters: Sphericityiscompoundsymmetryofpairwisedifferences

    Diagonalelements:samevariance Offdiagonalelements:samecovariance

    Nosphericity?AdjustmentstoFtests Inmodernmethodsthiscanevenbemoreflexible(heterogeneousvariances)

    3. MultivariateANOVA/GLM(TYPE=UN):Assumesnothingestimateseverything Everyelementin ismodeled Needmorepower(i.e.,samplesize)tomakeworkwell Mostgeneralprocedure

    ERSH8350:Lecture8 19

  • TypesofErrorCovarianceMatrixStructures

    InSASPROCMIXED,manytypesoferrorcovariancematrixstructuresareestimable(type=VC): Somearemorecommonthanothers Canusedevianceteststodeterminewhichismostappropriate Havetorunmultiplemodelstodeterminewhichisbest

    Here,Irunamodelforeach

    VarianceComponents Default(TYPE=VC):0 0

    0 00 0

    Assumeserrorsofallvariables: Havesamevariance Areindependent

    ERSH8350:Lecture8 20

  • VarianceComponentsStructureResult

    Thevariancecomponentsstructureresult:

    ERSH8350:Lecture8

    Note:thestandarderrorschangedforthefixedeffects

    WecanuseNeg2LogLikeinourDevianceTesttoseeifadifferentmodelispreferredstatistically

    21

  • Structure#2:CompoundSymmetry

    CompoundSymmetry (TYPE=CS):

    Assumeserrorsofallvariables: Havesamevariance Arecorrelated(covarianceis )

    ERSH8350:Lecture8 22

  • DevianceTestforCompoundSymmetry

    Thevariancecomponentsstructureisnestedwithinthecompoundsymmetricstructure(set ) Deviancetestispossible

    H0: 0 HA: 0

    DonotuseWaldtestorinformationcriteria Deviancetestismostaccuratewhenpossible

    2*LogL fromVC:486.6 2*LogL fromCS:435.3 Devianceteststatistic=486.6435.3=51.3

    Chisquaredistributedwith1df(fordifferenceinparameters) Pvalue:

  • Structure#3:HeterogeneousCS

    Anotherusefulstructureisheterogeneouscompoundsymmetry (TYPE=CSH):

    Assumeserrorsofallvariables: Havedifferentvariances , , Havesamecorrelation( )

    ERSH8350:Lecture8 24

  • DevianceTestforHeterogeneousCompoundSymmetry

    TheCSstructureisnestedwithintheCSHstructure Deviancetestispossible DonotuseWaldtestorinformationcriteria

    Deviancetestismostaccuratewhenpossible

    2*LogL fromCS:435.3 2*LogL fromCSH:415.8 Devianceteststatistic=435.3415.8=19.5

    Chisquaredistributedwith2df(fordifferenceinparameters)

    Pvalue:

  • Structure#4:Unstructured

    Finally,wehavetheunstructuredstructure(TYPE=UN):

    Makesnoassumptionsaboutstructure Needsmostparameters butcanbebest

    Ifsamplesizewasnotanissuewouldbebestchoice

    ERSH8350:Lecture8 26

  • DevianceTestforUNv.CSH

    TheCSHstructureisnestedwithintheUNstructure Deviancetestispossible DonotuseWaldtestorinformationcriteria

    Deviancetestismostaccuratewhenpossible

    2*LogL fromCSH:415.8 2*LogL fromUN:408.1

    Devianceteststatistic=415.8408.1=7.7 Chisquaredistributedwith2df(fordifferenceinparameters)

    Pvalue:=0.0212(fromExcel=chidist(7.7,2)) Conclusion:UNmodelfitsbetterthanCSH

    Therefore,weuseUNmodel UPNEXT:EVALUATINGFIXEDEFFECTS

    ERSH8350:Lecture8 27

  • TheHypothesisTestfortheMeans

    Inclusionofthedummycodedvariablebringsaboutthefollowinghypothesistest:

    Thenullhypothesisis:H0: =

    Thealternativehypothesisis:HA:atleastonemeannotequal

    Thepvalueofthehypothesistestissmall,sowerejectthenullhypothesis Wecanconcludethatatleastonepulseratemeanisnotequaltotheothertwo Thisisourwithinsubjectseffect

    ERSH8350:Lecture8 28

  • FurtherInspectingMeans Followingupthehypothesistest,wemaywishtoinvestigate

    whichmeansaresignificantlydifferent FromtheLSMEANSstatementinthesyntax

    LSM

Recommended

View more >