下载

1下载券

加入VIP
  • 专属下载特权
  • 现金文档折扣购买
  • VIP免费专区
  • 千万文档免费下载

上传资料

关闭

关闭

关闭

封号提示

内容

首页 最简明的指导:如何用SAS做多层回归分析(multilevel modeling)

最简明的指导:如何用SAS做多层回归分析(multilevel modeling).ppt

最简明的指导:如何用SAS做多层回归分析(multilevel…

formosa
2012-12-29 0人阅读 举报 0 0 暂无简介

简介:本文档为《最简明的指导:如何用SAS做多层回归分析(multilevel modeling)ppt》,可适用于高等教育领域

DoingHLMusingSASPROCMIXEDDoingHLMusingSASPROCMIXEDKazwwwestatusFebMypointsMypoints()EasytocompareHLMandothermodelsthatarenotHLMthus,helpfulThisisbecausePROCMIXEDletsyourunmodelsthatarenotHLM()EasytounderstandwhatmakesHLMHLMInSAS,whatisnotessentialtoHLMisdoneoutsidePROCMIXED(eg,centering)OLSvsHLMinPROCMIXEDThedifferenceisaRANDOMstatementOLSvsHLMinPROCMIXEDThedifferenceisaRANDOMstatementOLSregressionsyntaxPROCMIXEDMODELY=XRunHLMsyntaxPROCMIXEDModelY=XrandominterceptXsubject=schoolRun()OLSYjk=berrorjk()HLMLevel:Yjk=berrorjkLevel:b=gerrorkorYjk=berrorjkerrorkAgain,turningasimplelinearmodelintoHLMAgain,turningasimplelinearmodelintoHLM()PROCMIXEDModelY=XWRun()PROCMIXEDModelY=XWrandominterceptXWsubject=GroupIDRun()Randomstatementbelowreads:Irequestthattheintercept,aswellastheeffectsofXandWbeEstimatedforeachsubjectwhichcanbeidentifiedbyGroupIDHowtowriteSASPROCMIXEDsyntax:IntuitivewayHowtowriteSASPROCMIXEDsyntax:Intuitiveway()WriteallthevariablenamesatthemodelstatementmodelY=XW()Decidewhichvariables’effectyouwanttoestimatebyschoolsrandominterceptXWsubject=schoolMorecarefulwayMorecarefulwayStartfromlevelspecificspecificationeg,level:y=bb*Xerrorijlevel:b=gg*Werrorjlevel:b=gg*WerrorjInsertlevelequationsintolevelequationsWritethevariablenamesinvolvedinmodelstatementFind“randomcomponents”(writteninRomanalphabets)RULE:Put“intercept”intherandomstatementtoaccommodatehigherlevelerrorsRULE:Ifthenameofanyvariablessitsrightnexttolevelerrorwithanasterisk(eg,X*levelerror),putthosevariablenamesintherandomstatement(RULE:NoworryaboutresidualItissetbydefault)ExampleAnovaModelExampleAnovaModelLevel:Yij=bjResidualijLevel:bj=gUjY=gUjResidualprocmixed classgroupmodelY=randominterceptsubject=schoolrunIsaid:RULE:Put“intercept”intherandomstatementtoaccommodatehigherlevelerrorsRULE:Ifthenameofanyvariablessitsrightnexttolevelerrorwithanasterisk(eg,X*levelerror),putthosevariablenamesintherandomstatementONLYRULErelevantinthismodelExampleSlopeasoutcomemodelsExampleSlopeasoutcomemodelsLevel:Yij=bjbj*XResidualijLevel:bj=gg*WUjLevel:bj=gg*WUjY=gg*Wg*Xg*W*XUj*XUjResidualprocmixed classgroupmodelY=W  X  W*XrandominterceptXsubject=schoolrunWhatwereRULERULEHowtodosubstitution:CheatingusingHLMsoftware!Howtodosubstitution:CheatingusingHLMsoftware!PUSHMIXEDbuttontogetalittlewindowlikethisHowtodosubstitutionbyhandHowtodosubstitutionbyhandLevel:Yij=bjbj*XResidualijLevel:bj=gtg*WUjLevel:bj=gtg*WUjInserthigherlevelequationsintothelevelequationY=gg*WUj gg*WUj*XResidualij Takeoutthebrackets>Y=gg*WUj g*Xg*W*XUj*XResidualij NoticewhichpartsarestructuralpartandwhichpartsarerandomcomponentsY=gg*Wg*Xg*W*XUj*XUjResidualijprocmixedmodelWXW*XrandominterceptXsubject=schoolrunWhatwereruleandruleFixedEffectsorRandomEffectsFixedEffectsorRandomEffectsOLSregressionisafixedeffectmodelPROCMIXEDModelY=XRunOLSregressionisamodelwithfixedeffectsSoinawayOLSisaspecialcaseofHLMThisisanawfullyinflexiblemodelthatdoesnotconsidertheexistenceofvarioussourcesoferrorsHLMPROCMIXEDModelY=XrandominterceptXsubject=groupIDRunIfaresearcherthinkstheeffectofX(andtheintercept)isdifferentbygroups,soweshouldtreatthesecoefficientsasrandomeffectsBenefitofusingrandomeffectConceptualoneUsefultothinkaboutMicroMacroproblemsBenefitofusingrandomeffectConceptualoneUsefultothinkaboutMicroMacroproblems()Student:Mathscore=bb*parents’educationlevel…errorCountry:b=gg*SELECTIONerror()Classroom:teacherperceptionofmathabilityofclass=bb*averageparents’educationlevelb*averagemathscoreb*noiseerrorCountry:b=gg*NationalExamerrorb=gg*NationalExamerrorb=gg*NationalExamerrorBenefit:StatisticalbenefitBenefit:StatisticalbenefitStatisticalBenefitsInderivingagrandmean(re:theeffectofXoranintercept)HLMdoes“shrinkage”Thispullsinaccurategroupmeanstowardsthegrandmean,sowecanreducetheinfluenceofoutlinersiftheirestimatesareinaccurate(ie,havinglargeerrorvarianceandorcomingfromasmallnumberofobservationswithineachgroupunit)ShrunkSchoolmean=reliability*schoolmeanwherereliabilityisafunctionofNofobservationinagroupunitandvariance(RBHLMbook,p)Quiz:)whathappenstoaschoolwhosereliabilityis)Whathappensifallschoolsareonreliability)WhathappensifallschoolsareonreliabilityQuickdecisionruleRandomorfixQuickdecisionruleRandomorfixDoIopenthedooratPMLiteratureTheoryExploratoryanalysis(let’sseewhathappens)Moorecomplicated:Twostepdecisionsregardingrandomeffects(Ineedyourhelpinphrasingthis)Moorecomplicated:Twostepdecisionsregardingrandomeffects(Ineedyourhelpinphrasingthis)Step:EffectdifferentbyschoolStep:RandomorFixedFixed:Useaseriesofdummyvariables(inrealitytootedious)Random:ShrinkageappliesandgetaprecisionguidedgrandmeanExampleStudentEngagementstudyusingESMbyUekawa,Borman,andLeeExampleStudentEngagementstudyusingESMbyUekawa,Borman,andLeeEngagementLevel(Raschmodelcomposite)EngagementLevel(Raschmodelcomposite)Whenyouweresignaledthefirsttimetoday,SDDASA•Iwaspayingattention………………………OOOO•Ididnotfeellikelistening……………………OOOO•Mymotivationlevelwashigh………………OOOO•Iwasbored…………………………………OOOO•Iwasenjoyingclass…………………………OOOO•IwasfocusedmoreonclassthananythingelseOOOO•Iwishedtheclasswouldendsoon…………OOOO•Iwascompletelyintoclass…………………OOOOTheMEANSProcedureAnalysisVariable:engagementengagementNMeanStdDevMinimumMaximumƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒlevelHLMlevelHLMLevel:RepeatedMeasures(beeps)Level:Students(kidsfromaclass)Level:courses(courses,MondaytoFriday)levelHLMlevelHLMLibnamehere"C:"*Thisisthreelevelmodel*procmixeddata=hereesmcovtestnoclprintclassIDclassIDstudentmodelengagement=solutionddfm=krrandominterceptsub=IDstudent(IDclass)randominterceptsub=IDclassrunQuiz:howcanwemakethisalevelhlmPROCMIXEDstatementPROCMIXEDstatementprocmixeddata=hereesmcovtestnoclprint“covtest”doesatestforcovariancecomponents(whethervariancesaresignificantlylargerthanzero)ThereasonwhyyouhavetorequestsuchasimplethingisthatCOVTESTisnotbasedonchisquaretestthatonewoulduseforatestofvarianceItusesinsteadttestorsomethingthatisnotreallyappropriateShockingly,SAShasnotcorrectedthisproblemforawhileAnyways,becauseSASfeelsbadaboutit,itdoesnotwanttomakeitintoadefaultoption,whichiswhyyouhavetorequestthisNotmanypeopleknowthisandImyselfcouldnotbelievethisSoIguessthatmeansthatwecannotreallybelieveintheresultofCOVTESTandmustuseitwithcautionWhentherearelotsofgroupunits,useNOCLPRINTtosuppresstheprintingofgroupnamesCLASSstatementCLASSstatementclassIDclassIDstudentHispWethrowinthevariablesthatwewantSAStotreatascategoricalvariablesVariablesthatarecharacters(eg,citynames)mustbeonthisline(itwon’trunotherwise)GroupIDs,suchasIDclassinmyexampledata,mustbealsointheselinesotherwise,itwon’trunVariablesthatarenumericbutdummycoded(eg,black=ifblackelse)don’thavetobeinthisline,buttheoutputswilllookeasierifyoudoOnethingthatisapainintheneckwithCLASSstatementisthatitchoosesareferencecategorybyalphabeticalorderWhatevergroupinaclassificationvariablethatcomesthelastwhenalphabeticallyorderedwillbeusedasareferencegroupWecancontrolthisbydatamanipulationForexample,ifgender=BOYorGIRL,thenItendtocreateanewvariabletomakeitexplicitthatIgetgirltobeareferencegroup:Ifgender=”Boy”thengender=”()Boy”Ifgender=”Girl”thengender=”()Girl”MODELstatementMODELstatementmodelengagement=solutionddfm=krddfm=krspecificsthewaysinwhichthedegreeoffreedomiscalculatedItseemsmostclosetothedegreeoffreedomoptionusedbyBryk,Raudenbush,andCongdon’sHLMprogramCouldbecomputationallyveryheavyifamodeliscomplicatedddfm=bwwouldrunfaster,thoughDFwouldbewrongRandomstatementRandomstatementrandominterceptXsub=IDstudent(IDclass)randominterceptXsub=IDclassWecanestimatevarianceofslopesforcategoricalvariablesusing“group=“optionwithoutnecessarilymakingthemintodummyvariablesrandominterceptracesub=IDclassgroup=race(insteadof“randominterceptblackwhitehispanicsub=IDclass”)Libnamehere"G:SAS"procmixeddata=hereesmcovtestnoclprintweightprecisionweightclassIDclassIDstudentmodelengagement=solutionddfm=krrandominterceptsub=IDstudent(IDclass)randominterceptsub=IDclassrunLibnamehere"G:SAS"procmixeddata=hereesmcovtestnoclprintweightprecisionweightclassIDclassIDstudentmodelengagement=solutionddfm=krrandominterceptsub=IDstudent(IDclass)randominterceptsub=IDclassrunTheMixedProcedureCovarianceParameterEstimatesStandardZCovParmSubjectEstimateErrorValuePrZInterceptIDstudent(IDclass)<InterceptIDclassResidual<SolutionforFixedEffectsStandardEffectEstimateErrorDFtValuePr>|t|InterceptEngagement=bresidualestudentecourseMODELRQ:HowdoestheengagementscorevariesbystudentsandclassLibnamehere"G:SAS"procmixeddata=hereesmcovtestnoclprintweightprecisionweightclassIDclassIDstudentsubjectmodelengagement=hispsolutionddfm=krrandominterceptsub=IDstudent(IDclass)randomintercepthispsub=IDclassrunLibnamehere"G:SAS"procmixeddata=hereesmcovtestnoclprintweightprecisionweightclassIDclassIDstudentsubjectmodelengagement=hispsolutionddfm=krrandominterceptsub=IDstudent(IDclass)randomintercepthispsub=IDclassrunSolutionforFixedEffectsStandardEffectEstimateErrorDFtValuePr>|t|IntercepthispCovarianceParameterEstimatesStandardZCovParmSubjectEstimateErrorValuePrZInterceptIDstudent(IDclass)<InterceptIDclasshispIDclassResidual<MODELRQ:WhatistheeffectofbeingHispanicstudentsAndistheeffectvarybyclassMODELprocmixeddata=hereesmcovtestnoclprintweightprecisionweightclassIDclassIDstudentsubjectmodelengagement=hispmathhisp*mathsolutionddfm=krrandominterceptsub=IDstudent(IDclass)randomintercepthispsub=IDclassrunSolutionforFixedEffectsStandardEffectEstimateErrorDFtValuePr>|t|Intercepthispmathhisp*mathTheMixedProcedureCovarianceParameterEstimatesStandardZCovParmSubjectEstimateErrorValuePrZInterceptIDstudent(IDclass)<InterceptIDclasshispIDclassResidual<HispanicalienationphenomenonrelatedtosubjectMathversusScienceMODELSolutionforFixedEffectsStandardEffectEstimateErrorDFtValuePr>|t|Intercepthispmathhisp*mathTheMixedProcedureCovarianceParameterEstimatesStandardZCovParmSubjectEstimateErrorValuePrZInterceptIDstudent(IDclass)<AInterceptIDclassBhispIDclass>CResidual<Level:engagement=bb*HispanicresidualLevel:b=gALevel:b=gLevel:g=tt*MathBLevel:g=tt*MathCLevel:engagement=tt*Matht*Hispanict*Math*HispanicC*HispanicBAresidualVERSUSWhichiseasytounderstandWhichiseasytounderstandInHLMsoftwareInSASPROCMIXEDLevelInterceptDisappearsLevelInterceptDisappearsLevelInterceptInterceptLevelErrorResidualLevelErrorRandomeffectsLevelErrorRandomeffectsHLMwayLevel:engagement=bb*HispanicresidualLevel:b=gALevel:b=gLevel:g=tt*MathBLevel:g=tt*MathCPROCMIXEDwayLevel:engagement=tt*Matht*Hispanict*Math*HispanicC*HispanicBAresidualWhydowecentervariablesWhydowecentervariablesLevel:engagement=tt*Matht*Hispanict*Math*HispanicC*HispanicBAresidualImaginewehavetoreporttoteacherstheirstudents’averageengagementscoreWewanttouseBtTobeclearaboutMeaningoftpart,we“could”centervariables,ifitmakessenseWhataboutCenteringWhataboutCenteringInSAS,weusePROCSTANDARDtodocenteringandthisisoutsideofPROCMIXEDWhenIlearnedthis,Ithought,“Ihavedoneitbefore!”becausecenteringissimilartotheconceptofZscoresThisisGROUPMEANCenteringProcstandarddata=Xmean=byGroupIDvarXRunThisisGRANDMEANCenteringprocstandarddata=Xmean=varXRunBytheway,justforyourinformation,thisistocreateZscoresprocstandarddata=Xmean=STD=varXRunWhenyouuseSASPROCMIXED,younoticeCenteringisnotreallyatopicthatisspecifictoHLMbecauseitisdoneoutsidePROCMIXEDWhatdoesitmeantocenterdummyvariable,likegenderWhatdoesitmeantocenterdummyvariable,likegenderToadjustforgendercompositionWithoutit,theintercept=eithermaleorfemaleWithit,theinterceptisadjustedforgendercompositionSeemyExcelPresentationifwehavetimewwwestatussascenteringxlsENDENDTogobacktomyHLMpagewwwestatusidhtml

用户评价(0)

关闭

新课改视野下建构高中语文教学实验成果报告(32KB)

抱歉,积分不足下载失败,请稍后再试!

提示

试读已结束,如需要继续阅读或者下载,敬请购买!

文档小程序码

使用微信“扫一扫”扫码寻找文档

1

打开微信

2

扫描小程序码

3

发布寻找信息

4

等待寻找结果

我知道了
评分:

/32

最简明的指导:如何用SAS做多层回归分析(multilevel modeling)

VIP

在线
客服

免费
邮箱

爱问共享资料服务号

扫描关注领取更多福利