77范文网 - 专业文章范例文档资料分享平台

stata操作命令-xtreg(2)

来源:网络收集 时间:2018-12-04 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

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)在线全文阅读。

stata操作命令-xtreg(2).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/zonghe/339436.html(转载请注明文章来源)
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: