444xtreg—Fixed-,between-,andrandom-effects,andpopulation-averagedlinearmodels
££SE/Robust
??
vce(vcetype)speci?esthetypeofstandarderrorreported,whichincludestypesthatarederivedfromasymptotictheory,thatarerobusttosomekindsofmisspeci?cation,thatallowforintragroupcorrelation,andthatusebootstraporjackknifemethods;see[XT]vceoptions.vce(conventional),thedefault,usestheconventionallyderivedvarianceestimatorforgeneralizedleast-squaresregression.
Specifyingvce(robust)isequivalenttospecifyingvce(clusterpanelvar);seextreg,feinMethodsandformulas.
££Reporting
??
level(#);see[R]estimationoptions.
displayoptions:noomitted,vsquish,noemptycells,baselevels,allbaselevels;see[R]es-timationoptions.Thefollowingoptionisavailablewithxtregbutisnotshowninthedialogbox:coeflegend;see[R]estimationoptions.
OptionsforMLEmodel
££Model
??
noconstant;see[R]estimationoptions.
mlerequeststhemaximum-likelihoodrandom-effectsestimator.
££SE
??
vce(vcetype)speci?esthetypeofstandarderrorreported,whichincludestypesthatarederivedfromasymptotictheoryandthatusebootstraporjackknifemethods;see[XT]vceoptions.
££Reporting
??
level(#);see[R]estimationoptions.
displayoptions:noomitted,vsquish,noemptycells,baselevels,allbaselevels;see[R]es-timationoptions.
££????maximizeoptions:iterate(#),nolog,trace,tolerance(#),ltolerance(#),from(initspecs);see[R]maximize.Theseoptionsareseldomused.Thefollowingoptionisavailablewithxtregbutisnotshowninthedialogbox:coeflegend;see[R]estimationoptions.
Maximization
??
OptionsforPAmodel
££Model
??
noconstant;see[R]estimationoptions.
xtreg—Fixed-,between-,andrandom-effects,andpopulation-averagedlinearmodels445
parequeststhepopulation-averagedestimator.Forlinearregression,thisisthesameasarandom-effectsestimator(bothinterpretationshold).xtreg,paisequivalenttoxtgee,family(gaussian)link(id)corr(exchangeable),whicharethedefaultsforthextgeecommand.xtreg,paallowsalltherelevantxtgeeoptionssuchasvce(robust).Whetheryouusextreg,paorxtgeemakesnodifference.See[XT]xtgee.offset(varname);see[R]estimationoptions.
££Correlation
??
corr(correlation),force;see[R]estimationoptions.
££SE/Robust
??
vce(vcetype)speci?esthetypeofstandarderrorreported,whichincludestypesthatarederivedfromasymptotictheory,thatarerobusttosomekindsofmisspeci?cation,andthatusebootstraporjackknifemethods;see[XT]vceoptions.vce(conventional),thedefault,usestheconventionallyderivedvarianceestimatorforgeneralizedleast-squaresregression.nmp;see[XT]vceoptions.
rgfspeci?esthattherobustvarianceestimateismultipliedby(N?1)/(N?P),whereNisthetotalnumberofobservationsandPisthenumberofcoef?cientsestimated.Thisoptioncanbeusedwithfamily(gaussian)onlywhenvce(robust)iseitherspeci?edorimpliedbytheuseofpweights.Usingthisoptionimpliesthattherobustvarianceestimateisnotinvarianttothescaleofanyweightsused.scale(x2|dev|phi|#);see[XT]vceoptions.
££Reporting
??
level(#);see[R]estimationoptions.
displayoptions:noomitted,vsquish,noemptycells,baselevels,allbaselevels;see[R]es-timationoptions.
££Optimization
??
optimizeoptionscontroltheiterativeoptimizationprocess.Theseoptionsareseldomused.iterate(#)speci?esthemaximumnumberofiterations.Whenthenumberofiterationsequals#,theoptimizationstopsandpresentsthecurrentresults,evenifconvergencehasnotbeenreached.Thedefaultisiterate(100).
tolerance(#)speci?esthetoleranceforthecoef?cientvector.Whentherelativechangeinthecoef?cientvectorfromoneiterationtothenextislessthanorequalto#,theoptimizationprocessisstopped.tolerance(1e-6)isthedefault.nologsuppressesdisplayoftheiterationlog.
tracespeci?esthatthecurrentestimatesbeprintedateachiteration.Thefollowingoptionisavailablewithxtregbutisnotshowninthedialogbox:coeflegend;see[R]estimationoptions.
446xtreg—Fixed-,between-,andrandom-effects,andpopulation-averagedlinearmodels
Remarks
Ifyouhavenotread[XT]xt,pleasedoso.
SeeBaltagi(2008,chap.2)andWooldridge(2009,chap.14)forgoodoverviewsof?xed-effectsandrandom-effectsmodels.Allison(2009)providesperspectiveontheuseof?xed-versusrandom-effectsestimatorsandprovidesmanyexamplesusingStata.Consider?ttingmodelsoftheform
yit=α+xitβ+νi+??it(1)
Inthismodel,νi+??itistheresidualthatwehavelittleinterestin;wewantestimatesofβ.νiistheunit-speci?cresidual;itdiffersbetweenunits,butforanyparticularunit,itsvalueisconstant.Inthepulmonarydataof[XT]xt,apersonwhoexerciseslesswouldpresumablyhavealowerforcedexpiratoryvolume(FEV)yearafteryearandsowouldhaveanegativeνi.
??itisthe“usual”residualwiththeusualproperties(mean0,uncorrelatedwithitself,uncorrelatedwithx,uncorrelatedwithν,andhomoskedastic),althoughinamorethoroughdevelopment,wecoulddecompose??it=υt+ωit,assumethatωitisastandardresidual,andbetterdescribeυt.
Beforemakingtheassumptionsnecessaryforestimation,let’sperformsomeusefulalgebraon(1).Whateverthepropertiesofνiand??it,if(1)istrue,itmustalsobetruethat
yi=α+xiβ+νi+??i(2)
??????
whereyi=tyit/Ti,xi=txit/Ti,and??i=t??it/Ti.Subtracting(2)from(1),itmustbeequallytruethat
(3)(yit?yi)=(xit?xi)β+(??it???i)Thesethreeequationsprovidethebasisforestimatingβ.Inparticular,xtreg,feprovideswhatis
knownasthe?xed-effectsestimator—alsoknownasthewithinestimator—andamountstousingOLStoperformtheestimationof(3).xtreg,beprovideswhatisknownasthebetweenestimatorandamountstousingOLStoperformtheestimationof(2).xtreg,reprovidestherandom-effectsestimatorandisa(matrix)weightedaverageoftheestimatesproducedbythebetweenandwithinestimators.Inparticular,therandom-effectsestimatorturnsouttobeequivalenttoestimationof
(yit?θyi)=(1?θ)α+(xit?θxi)β+{(1?θ)νi+(??it?θ??i)}
(4)
222
whereθisafunctionofσνandσ??.Ifσν=0,meaningthatνiisalways0,θ=0and(1)can
2
beestimatedbyOLSdirectly.Alternatively,ifσ??=0,meaningthat??itis0,θ=1andthewithinestimatorreturnsalltheinformationavailable(whichwill,infact,bearegressionwithanR2of1).
Formorereasonablecases,fewassumptionsarerequiredtojustifythe?xed-effectsestimatorof(3).Theestimatesare,however,conditionalonthesampleinthattheνiarenotassumedtohaveadistributionbutareinsteadtreatedas?xedandestimable.Thisstatistical?nepointcanleadtodif?cultywhenmakingout-of-samplepredictions,butthataside,the?xed-effectsestimatorhasmuchtorecommendit.
Moreisrequiredtojustifythebetweenestimatorof(2),buttheconditioningonthesampleisnotassumedbecauseνi+??iistreatedasaresidual.Newlyrequiredisthatweassumethatνiandxiareuncorrelated.ThisfollowsfromtheassumptionsoftheOLSestimatorbutisalsotransparent:wereνiandxicorrelated,theestimatorcouldnotdeterminehowmuchofthechangeinyi,associatedwithanincreaseinxi,toassigntoβversushowmuchtoattributetotheunknowncorrelation.(This,ofcourse,suggeststheuseofaninstrumental-variableestimator,zi,whichiscorrelatedwithxibutuncorrelatedwithνi,thoughthatapproachisnotimplementedhere.)
xtreg—Fixed-,between-,andrandom-effects,andpopulation-averagedlinearmodels447
Therandom-effectsestimatorof(4)requiresthesameno-correlationassumption.Incomparisonwiththebetweenestimator,therandom-effectsestimatorproducesmoreef?cientresults,albeitoneswithunknownsmall-sampleproperties.Thebetweenestimatorislessef?cientbecauseitdiscardstheover-timeinformationinthedatainfavorofsimplemeans;therandom-effectsestimatorusesboththewithinandthebetweeninformation.
Allthiswouldseemtoleavethebetweenestimatorof(2)withnorole(exceptforaminor,
22
technicalpartitplaysinhelpingtoestimateσνandσ??,whichareusedinthecalculationofθ,onwhichtherandom-effectsestimatesdepend).Let’s,however,consideravariationon(1):
yit=α+xiβ1+(xit?xi)β2+νi+??it
(1??)
Inthismodel,wepostulatethatchangesintheaveragevalueofxforanindividualhaveadifferenteffectfromtemporarydeparturesfromtheaverage.Inaneconomicsituation,ymightbepurchasesofsomeitemandxincome;achangeinaverageincomeshouldhavemoreeffectthanatransitorychange.Inaclinicalsituation,ymightbeaphysicalresponseandxthelevelofachemicalinthebrain;themodelallowsadifferentresponsetopermanentratherthantransitorychanges.Thevariationsof(2)and(3)correspondingto(1??)are
yi=α+xiβ1+νi+??i
(yit?yi)=(xit?xi)β2+(??it???i)
(2??)(3??)
Thatis,thebetweenestimatorestimatesβ1andthewithinβ2,andneitherestimatestheother.Thusevenwhenestimatingequationslike(1),itisworthcomparingthewithinandbetweenestimators.Differencesinresultscansuggestmodelslike(1??),orattheleastsomeotherspeci?cationerror.Finally,itisworthunderstandingtheroleofthebetweenandwithinestimatorswithregressorsthatareconstantovertimeorconstantoverunits.Considerthemodel
yit=α+xitβ1+siβ2+ztβ3+νi+??it
(1????)
Thismodelisthesameas(1),exceptthatweexplicitlyidentifythevariablesthatvaryoverbothtimeandi(xit,suchasoutputorFEV);variablesthatareconstantovertime(si,suchasraceorsex);andvariablesthatvarysolelyovertime(zt,suchastheconsumerpriceindexorageinacohortstudy).Thecorrespondingbetweenandwithinequationsare
yi=α+xiβ1+siβ2+zβ3+νi+??i
(yit?yi)=(xit?xi)β1+(zt?z)β3+(??it???i)
(2????)(3????)
Inthebetweenestimatorof(2????),noestimateofβ3ispossiblebecausezisaconstantacrosstheiobservations;theregression-estimatedinterceptwillbeanestimateofα+zβ3.Ontheotherhand,itcanprovideestimatesofβ1andβ2.Itcanestimateeffectsoffactorsthatareconstantovertime,suchasraceandsex,buttodosoitmustassumethatνiisuncorrelatedwiththosefactors.Thewithinestimatorof(3????),likethebetweenestimator,providesanestimateofβ1butprovidesnoestimateofβ2fortime-invariantfactors.Instead,itprovidesanestimateofβ3,theeffectsofthetime-varyingfactors.Thewithinestimatorcanalsoprovideestimatesuiforνi.Morecorrectly,theestimatoruiisanestimatorofνi+siβ2.Thusuiisanestimatorofνionlyiftherearenotime-invariantvariablesinthemodel.Iftherearetime-invariantvariables,uiisanestimateofνiplustheeffectsofthetime-invariantvariables.
Remarksarepresentedunderthefollowingheadings:
Assessinggoodnessof?t
xtregandassociatedcommands
448xtreg—Fixed-,between-,andrandom-effects,andpopulation-averagedlinearmodels
Assessinggoodnessof?t
??R2isapopularmeasureofgoodnessof?tinordinaryregression.Inourcase,givenα??andβ
estimatesofαandβ,wecanassessthegoodnessof?twithrespectto(1),(2),or(3).Thepredictionequationsare,respectively,
??y??it=α??+xitβ????yi=α??+xiβ
????yi)=(xit?xi)βy??it=(y??it???(1??????)(2??????)(3??????)
xtregreports“R-squares”correspondingtothesethreeequations.R-squaresisinquotesbecause
theR-squaresreporteddonothaveallthepropertiesoftheOLSR2.
TheordinarypropertiesofR2includebeingequaltothesquaredcorrelationbetweeny??andyandbeingequaltothefractionofthevariationinyexplainedbyy??—formallyde?nedasVar(y??)/Var(y).Theidentityofthede?nitionsisfromaspecialpropertyoftheOLSestimates;ingeneral,givenapredictiony??fory,thesquaredcorrelationisnotequaltotheratioofthevariances,andtheratioofthevariancesisnotrequiredtobelessthan1.
xtregreportsR2valuescalculatedascorrelationssquared,callingthemR2overall,correspondingto(1??????);R2between,correspondingto(2??????);andR2within,correspondingto(3??????).Infact,youcanthinkofeachofthesethreenumbersashavingallthepropertiesofordinaryR2s,ifyoubearinmindthatthepredictionbeingjudgedisnoty??it,??yi,and??y??it,butγ1y??itfromtheregressionyit=γ1y??it;γ2??yifromtheregressionyi=γ2??yi;andγ3??y??itfromy??it=γ3??y??it.Inparticular,xtreg,beobtainsitsestimatesbyperformingOLSon(2),andthereforeitsreportedRbetweenisanordinaryR2.TheothertworeportedR2saremerelycorrelationssquared,or,ifyouprefer,R2sfromthesecond-roundregressionsyit=γ11y??itandy??it=γ13??y??it.
2
xtreg,feobtainsitsestimatesbyperformingOLSon(3),soitsreportedR2withinisanordinaryR2.Aswithbe,theotherR2sarecorrelationssquared,or,ifyouprefer,R2sfromthesecond-round
yiand,aswithbe,y??it=γ23??y??it.regressionsyi=γ22??xtreg,reobtainsitsestimatesbyperformingOLSon(4);noneoftheR2scorrespondingto(1??????),
(2??????),or(3??????)corresponddirectlytothisestimator(the“relevant”R2istheonecorrespondingto(4)).AllthreereportedR2sarecorrelationssquared,or,ifyouprefer,fromsecond-roundregressions.
xtregandassociatedcommandsExample1:Between-effectsmodel
Usingnlswork.dtadescribedin[XT]xt,wewillmodellnwageintermsofcompletedyearsofschooling(grade),currentageandagesquared,currentyearsworked(experience)andexperiencesquared,currentyearsoftenureonthecurrentjobandtenuresquared,whetherblack(race=2),whetherresidinginanareanotdesignatedastandardmetropolitanstatisticalarea(SMSA),andwhetherresidingintheSouth.
.usehttp://www.stata-press.com/data/r11/nlswork
(NationalLongitudinalSurvey.YoungWomen14-26yearsofagein1968)
Toobtainthebetween-effectsestimates,weusextreg,be.nlswork.dtahaspreviouslybeenxtsetidcodeyearbecausethatiswhatistrueofthedata,butforrunningxtreg,itwouldhavebeensuf?cienttohavextsetidcodebyitself.
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库stata操作命令-xtreg(2)在线全文阅读。
相关推荐: