您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 信息化管理 > R语言处理面板数据--plm包
JSSJournalofStatisticalSoftwareJuly2008,Volume27,Issue2.:TheplmPackageYvesCroissantUniversiteLumiereLyon2GiovanniMilloUniversityofTriesteandGeneraliSpAAbstractPaneldataeconometricsisobviouslyoneofthemaineldsintheprofession,butmostofthemodelsusedarediculttoestimatewithR.plmisapackageforRwhichintendstomaketheestimationoflinearpanelmodelsstraightforward.plmprovidesfunctionstoestimateawidevarietyofmodelsandtomake(robust)inference.Keywords:paneldata,covariancematrixestimators,generalizedmethodofmoments,R.1.IntroductionPaneldataeconometricsisacontinuouslydevelopingeld.Theincreasingavailabilityofdataobservedoncross-sectionsofunits(likehouseholds,rms,countriesetc.)andovertimehasgivenrisetoanumberofestimationapproachesexploitingthisdoubledimensionalitytocopewithsomeofthetypicalproblemsassociatedwitheconomicdata,rstofallthatofunobservedheterogeneity.Timewiseobservationofdatafromdierentobservationalunitshaslongbeencommoninothereldsofstatistics(wheretheyareoftentermedlongitudinaldata).Inthepaneldataeldaswellasinothers,theeconometricapproachisneverthelesspeculiarwithrespecttoexperimentalcontexts,asitisemphasizingmodelspecicationandtestingandtacklinganumberofissuesarisingfromtheparticularstatisticalproblemsassociatedwitheconomicdata.Thus,whileaverycomprehensivesoftwareframeworkfor(amongmanyotherfeatures)max-imumlikelihoodestimationoflinearregressionmodelsforlongitudinaldata,packagesnlme(Pinheiro,Bates,DebRoy,andSarkar2007)andlme4(Bates2007),isavailableintheR(RDevelopmentCoreTeam2008)environmentandcanbeused,e.g.,forestimationofrandomeectspanelmodels,itsuseisnotintuitiveforapracticingeconometrician,andmaximumlikelihoodestimationisonlyoneofthepossibleapproachestopaneldataeconometrics.More-over,economicpaneldatasetsoftenhappentobeunbalanced(i.e.,theyhaveadierentnumber2PanelDataEconometricsinR:TheplmPackageofobservationsbetweengroups),whichcaseneedssomeadaptationtothemethodsandisnotcompatiblewiththoseinnlme.Hencetheneedforapackagedoingpaneldata\fromtheeconometrician'sviewpointandfeaturingataminimumthebasictechniqueseconometri-ciansthemselvesareusedto:randomandxedeectsestimationofstaticlinearpaneldatamodels,variablecoecientsmodels,generalizedmethodofmomentsestimationofdynamicmodels;andthebasictoolboxofspecicationandmisspecicationdiagnostics.Furthermore,wefelttherewastheneedforautomationofsomebasicdatamanagementtasksaslagging,summingand,moreingeneral,applying(intheRsense)functionstothedata,which,althoughconceptuallysimple,becomecumbersomeanderror-proneontwo-dimensionaldata,especiallyinthecaseofunbalancedpanels.Theresultofourworkisbundledintheplmadd-onpackage,availablefromtheComprehensiveRArchiveNetworkat=plm.Thepaperisorganizedasfollows:Section2presentsaveryshortoverviewofthetypicalmodeltaxonomy1.Section3discussesthesoftwareapproachusedinthepackage.Thenextthreesectionspresentthefunctionalitiesofthepackageinmoredetail:datamanagement(Section4),estimation(Section5)andtesting(Section6),givingashortdescriptionandillustratingthemwithexamples.Section7comparestheapproachinplmtothatofnlmeandlme4,highlightingthefeaturesofthelattertwothataneconometricianmightndmostuseful.Section8concludesthepaper.2.ThelinearpanelmodelThebasiclinearpanelmodelsusedineconometricscanbedescribedthroughsuitablerestric-tionsofthefollowinggeneralmodel:yit=it+itxit+uit(1)wherei=1;:::nistheindividual(group,country,...)index,t=1;:::;Tisthetimeindexanduitarandomdisturbancetermofmean0.OfcoursethelatterisnotestimablewithN=nTdatapoints.Anumberofassumptionsareusuallymadeabouttheparameters,theerrorsandtheexogeneityoftheregressors,givingrisetoataxonomyoffeasiblemodelsforpaneldata.Themostcommononeisparameterhomogeneity,whichmeansthatit=foralli;tandit=foralli;t.Theresultingmodelyit=+xit+uit(2)isastandardlinearmodelpoolingallthedataacrossiandt.Tomodelindividualheterogeneity,oneoftenassumesthattheerrortermhastwoseparatecomponents,oneofwhichisspecictotheindividualanddoesnotchangeovertime2.Thisiscalledtheunobservedeectsmodel:1Comprehensivetreatmentsaretobefoundinmanyeconometricstextbooks,e.g.Baltagi(2001)orWooldridge(2002):thereaderisreferredtothese,especiallytotherstninechaptersofBaltagi(2001).2Forthesakeofexpositionweareconsideringonlytheindividualeectscasehere.Theremayalsobetimeeects,whichisasymmetriccase,orbothofthem,sothattheerrorhasthreecomponents:uit=i+t+it.JournalofStatisticalSoftware3yit=+xit+i+it(3)Theappropriateestimationmethodforthismodeldependsonthepropertiesofthetwoerrorcomponents.Theidiosyncraticerroritisusuallyassumedwell-behavedandindependentfromboththeregressorsxitandtheindividualerrorcomponenti.Theindividualcomponentmaybeinturneitherindependentfromtheregressorsorcorrelated.Ifitiscorrelated,theordinaryleastsquares(OLS)estimatorforwouldbeinconsistent,soitiscustomarytotreattheiasafurthersetofnparameterstobeestimated,asifinthegeneralmodelit=iforallt.Thisiscalledthexedeects(alsoknownaswithinorleastsquaresdummyvariables)model,usuallyes
本文标题:R语言处理面板数据--plm包
链接地址:https://www.777doc.com/doc-4381571 .html