0% found this document useful (0 votes)
284 views13 pages

Panel GMM Commands

This document provides help information for the xtabond2 command in Stata, which estimates dynamic panel data models using the Arellano-Bond GMM estimator and the system GMM estimator developed by Blundell and Bond. It can be used with cross-sectional time-series data and allows for individual fixed effects, heteroskedasticity, and autocorrelation within panels. The command implements both difference GMM and system GMM estimators, using either first-differencing or orthogonal deviations to remove fixed effects. It reports the Arellano-Bond test for autocorrelation of residuals to check the validity of lagged variables as instruments.

Uploaded by

Saira Abid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
284 views13 pages

Panel GMM Commands

This document provides help information for the xtabond2 command in Stata, which estimates dynamic panel data models using the Arellano-Bond GMM estimator and the system GMM estimator developed by Blundell and Bond. It can be used with cross-sectional time-series data and allows for individual fixed effects, heteroskedasticity, and autocorrelation within panels. The command implements both difference GMM and system GMM estimators, using either first-differencing or orthogonal deviations to remove fixed effects. It reports the Arellano-Bond test for autocorrelation of residuals to check the validity of lagged variables as instruments.

Uploaded by

Saira Abid
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

5/6/2017 repec.org/bocode/x/xtabond2.

html


helpforxtabond2

"Difference"and"system"GMMdynamicpanelestimator

xtabond2depvarvarlist[ifexp][inrange][weight][,level(#)
svmattwosteprobustcluster(varname)noconstantsmall
noleveleqorthogonalgmmopt[gmmopt...]ivopt[ivopt...]
pcacomponents(#)artests(#)arlevelsh(#)nodiffsargan
nomata]

wheregmmoptis

gmmstyle(varlist[,laglimits(##)collapseorthogonalequation({diff
|level|both})passthrusplit])

andivoptis

ivstyle(varlist[,equation({diff|level|both})passthrumz])

aweights,pweights,andfweightsareallowed.fweightsmustbeconstant
overtime.Seehelpweights.

xtabond2isforusewithcrosssectiontimeseriesdata.Youmusttsset
yourdatabeforeusingxtabond2;seehelptsset.

Allvarlistsmaycontaintimeseriesoperatorsand,inStataversion11
orlater,factorvariables.Seehelpvarlist.

by...:maybeusedwithxtabond2ifnotimeseriesoperatorsareused
inthecommandline.Thebyclausewillnotrestrictthesamplefrom
whichlagsaredrawninbuildinginstruments.Seehelpby.

xtabond2sharesfeaturesofallestimationcommands;seehelpestcom.

Thesyntaxofpredictfollowingxtabond2is

predict[type]newvarname[ifexp][inrange][,statistic]
[difference]

wherestatisticis

xbbx_it,fittedvalues(thedefault)
residualse_it,theresiduals

Description

http://repec.org/bocode/x/xtabond2.html 1/13
5/6/2017 repec.org/bocode/x/xtabond2.html

xtabond2canfittwocloselyrelateddynamicpaneldatamodels.The
firstistheArellanoBond(1991)estimator,whichisalsoavailablewith
xtabond,thoughwithoutthetwostepstandarderrorcorrectiondescribed
below.Itissometimescalled"differenceGMM."Thesecondisan
augmentedversionoutlinedbyArellanoandBover(1995)andfully
developedbyBlundellandBond(1998).Itisknownas"systemGMM."
Roodman(2009)providesapedagogicintroductiontolinearGMM,these
estimators,andxtabond2.Theestimatorsaredesignedfordynamic
"smallT,largeN"panelsthatmaycontainfixedeffectsandseparate
fromthosefixedeffectsidiosyncraticerrorsthatareheteroskedastic
andcorrelatedwithinbutnotacrossindividuals.Considerthemodel:

y_it=x_it*b_1+w_it*b_2+u_iti=1,...,N;t=1,...,T
u_it=v_i+e_it,

where

v_iareunobservedindividualleveleffects;

e_itaretheobservationspecificerrors;

x_itisavectorofstrictlyexogenouscovariates(onesdependenton
neithercurrentnorpaste_it);

w_itisavectorofpredeterminedcovariates(whichmayincludethelag
ofy)andendogenouscovariates,allofwhichmaybecorrelated
withthev_i(Predeterminedvariablesarepotentiallycorrelated
withpasterrors.Endogenousonesarepotentiallycorrelated
withpastandpresenterrors.);

b_1andb_2arevectorsofparameterstobeestimated;

andE[v_i]=E[e_it]=E[v_i*e_it]=0,andE[e_it*e_js]=0foreachi,j,t,s,
i<>j.

Firstdifferencingtheequationremovesthev_i,thuseliminatinga
potentialsourceofomittedvariablebiasinestimation.However,
differencingvariablesthatarepredeterminedbutnotstrictlyexogenous
makesthemendogenoussincethew_itinsomeD.w_it=w_itw_i,t1is
correlatedwiththee_i,t1inD.e_it.FollowingHoltEakin,Newey,and
Rosen(1988),ArellanoandBond(1991)developaGeneralizedMethodof
Momentsestimatorthatinstrumentsthedifferencedvariablesthatarenot
strictlyexogenouswithalltheiravailablelagsinlevels.(Strictly
exogenousvariablesareuncorrelatedwithcurrentandpasterrors.)
ArellanoandBondalsodevelopanappropriatetestforautocorrelation,
which,ifpresent,canrendersomelagsinvalidasinstruments.

AproblemwiththeoriginalArellanoBondestimatoristhatlaggedlevels
arepoorinstrumentsforfirstdifferencesifthevariablesarecloseto
arandomwalk.ArellanoandBover(1995)describehow,iftheoriginal
equationinlevelsisaddedtothesystem,additionalinstrumentscanbe
broughttobeartoincreaseefficiency.Inthisequation,variablesin
levelsareinstrumentedwithsuitablelagsoftheirownfirst
differences.Theassumptionneededisthatthesedifferencesare
uncorrelatedwiththeunobservedcountryeffects.BlundellandBondshow

http://repec.org/bocode/x/xtabond2.html 2/13
5/6/2017 repec.org/bocode/x/xtabond2.html

thatthisassumptioninturndependsonamorepreciseoneaboutinitial
conditions.

xtabond2implementsbothestimatorstwice.TheversioninStatasado
programminglanguageisslowbutcompatiblewithStata7and8.TheMata
versionisusuallyfaster,andrunsinStata10.0orlater.Thextabond2
optionnomatapreventstheuseofMataevenwhenitisavailable.

TheMataversionalsoincludestheoptiontousetheforwardorthogonal
deviationstransforminsteadoffirstdifferencing.ProposedbyArellano
andBover(1995)theorthogonaldeviationstransform,ratherthan
subtractingthepreviousobservation,subtractstheaverageofall
availablefutureobservations.Theresultisthenmultipliedbyascale
factorchosentoyieldthenicebutrelativelyunimportantpropertythat
iftheoriginale_itarei.i.d.,thensoarethetransformedones(see
ArellanoandBover(1995)andRoodman(2009)).Likedifferencing,taking
orthogonaldeviationsremovesfixedeffects.Becauselaggedobservations
ofavariabledonotentertheformulaforthetransformation,they
remainorthogonaltothetransformederrors(assumingnoserial
correlation),andavailableasinstruments.Infact,forconsistency,
thesoftwarestorestheorthogonaldeviationofanobservationoneperiod
late,sothat,aswithdifferencing,observationsforperiod1are
missingand,foraninstrumentingvariablew,w_i,t1enterstheformula
forthetransformedobservationstoredati,t.Withthismove,exactly
thesamelagsofvariablesarevalidasinstrumentsunderthetwo
transformations.

Onbalancedpanels,GMMestimatorsbasedonthetwotransformsreturn
numericallyidenticalcoefficientestimates,holdingtheinstrumentset
fixed(ArellanoandBover1995).Butorthogonaldeviationshasthe
virtueofpreservingsamplesizeinpanelswithgaps.Ifsomee_itis
missing,forexample,neitherD.e_itnorD.e_i,t+1canbecomputed.But
theorthogonaldeviationcanbecomputedforeverycompleteobservation
exceptthelastforeachindividual.(Firstdifferencingcandono
bettersinceitmustdropthefirstobservationforeachindividual.)
Notethat"differenceGMM"isstillcalledthatevenwhenorthogonal
deviationsareused.Wewillrefertotheequationindifferencesor
orthogonaldeviationsasthetransformedequation.InsystemGMMwith
orthogonaldeviations,thelevelsoruntransformedequationisstill
instrumentedwithdifferencesasdescribedabove.

xtabond2reportstheArellanoBondtestforautocorrelation,whichis
appliedtothedifferencedresidualsinordertopurgetheunobservedand
perfectlyautocorrelatedv_i.AR(1)isexpectedinfirstdifferences,
becauseD.e_i,t=e_i,te_i,t1shouldcorrelatewithD.e_i,t1=
e_i,t1e_i,t2sincetheysharethee_i,t1term.Sotocheckfor
AR(1)inlevels,lookforAR(2)indifferences,ontheideathatthis
willdetecttherelationshipbetweenthee_i,t1inD.e_i,tandthe
e_i,t2inD.e_i,t2.Thisreasoningdoesnotworkfororthogonal
deviations,inwhichtheresidualsforanindividualareall
mathematicallyinterrelated,thuscontaminatedfromthepointofviewof
detectingARinthee_it.Sothetestisrunondifferencedresiduals
evenafterestimationindeviations.Autocorrelationindicatesthatlags
ofthedependentvariable(andanyothervariablesusedasinstruments
thatarenotstrictlyexogenous),areinfactendogenous,thusbad
instruments.Forexample,ifthereisAR(s),theny_i,tswouldbe
correlatedwithe_i,ts,whichwouldbecorrelatedwithD.e_i,ts,which
wouldbecorrelatedwithD.e_i,t.

xtabond2alsoreportstestsofoveridentifyingrestrictionsofwhether

http://repec.org/bocode/x/xtabond2.html 3/13
5/6/2017 repec.org/bocode/x/xtabond2.html

theinstruments,asagroup,appearexogenous.Foronestep,nonrobust
estimation,itreportstheSarganstatistic,whichistheminimizedvalue
oftheonestepGMMcriterionfunction.TheSarganstatisticisnot
robusttoheteroskedasticityorautocorellation.Soforonestep,robust
estimation(andforalltwostepestimation),xtabond2alsoreportsthe
HansenJstatistic,whichistheminimizedvalueofthetwostepGMM
criterionfunction,andisrobust.xtabond2stillreportstheSargan
statisticinthesecasesbecausetheJtesthasitsownproblem:itcan
begreatlyweakenedbyinstrumentproliferation.TheMataversiongoes
further,reportingdifferenceinSarganstatistics(really,
differenceinHansenstatistics,exceptinonesteprobustestimation),
whichtestforwhethersubsetsofinstrumentsarevalid.Tobeprecise,
itreportsonetestforeachgroupofinstrumentsdefinedbyanivstyle()
orgmmstyle()option(explainedbelow).Soreplacinggmmstyle(xy)ina
commandlinewithgmmstyle(x)gmmstyle(y)willyieldthesameestimate
butdistinctdifferenceinSargan/Hansentests.Inaddition,including
thesplitsuboptioninagmmstyle()optioninsystemGMMsplitsan
instrumentgroupintwofordifferenceinSargan/Hansenpurposes,one
eachforthetransformedequationandlevelsequations.Thisis
especiallyusefulfortestingtheinstrumentsforthelevelsequation
basedonlaggeddifferencesofthedependentvariable,whicharethemost
suspectinsystemGMMandthesubjectofthe"initialconditions"inthe
titleofBlundellandBond(1998).Inthesamevein,insystemGMM,
xtabond2alsotestsalltheGMMtypeinstrumentsforthelevelsequation
asagroup.Allofthesetests,however,areweakwhentheinstrument
countishigh.DifferenceinSargan/Hansentestsarearecomputationally
intensivesincetheyinvolvereestimatingthemodelforeachtest;the
nodiffsarganoptionisavailabletopreventthem.

AslinearGMMestimators,theArellanoBondandBlundellBondestimators
haveoneandtwostepvariants.Butthoughtwostepisasymptotically
moreefficient,thereportedtwostepstandarderrorstendtobeseverely
downwardbiased(ArellanoandBond1991;BlundellandBond1998).To
compensate,xtabond2makesavailableafinitesamplecorrectiontothe
twostepcovariancematrixderivedbyWindmeijer(2005).Thiscanmake
twosteprobustestimationsmoreefficientthanonesteprobust,
especiallyforsystemGMM.

Standarderrorscanalsobe"bootstrapped"butnotwiththebootstrap
command.Thatcommandbuildstemporarydatasetsbysamplingtherealone
withreplacement.Andhavingmultipleobservationsforagiven
observationalunitandtimeperiodviolatespanelstructure.Instead,use
jacknife,perhapswiththecluster()option,clusteringonthepanel
identifiervariable,inordertodropeachobservationalunitinturn.

Thesyntaxofxtabond2differssubstantiallyfromthatofxtabondand
xtdpdsys.xtabond2almostcompletelydecouplesspecificationof
regressorsfromspecificationofinstruments.Asaresult,most
variablesusedwillappeartwiceinanxtabond2commandline.xtabond2
requirestheinitialvarlistofthecommandlinetoincludeall
regressorsexceptfortheoptionalconstantterm,betheystrictly
exogenous,predetermined,orendogenous.Variablesusedtoform
instrumentsthenappearingmmstyle()orivstyle()optionsafterthe
comma.Theresultisalossofparsimony,butfullercontroloverthe
instrumentmatrix.Variablescanbeusedasthebasisfor"GMMstyle"
instrumentsetswithoutbeingincludedasregressors,orviceversa.

Thegmmstyle()andivstyle()optionsalsohavesuboptionsthatallow
furthercustomizationoftheinstrumentmatrix.

http://repec.org/bocode/x/xtabond2.html 4/13
5/6/2017 repec.org/bocode/x/xtabond2.html

Citation
xtabond2isnotanofficialStatacommand.Itisafreecontributionto
theresearchcommunity.Pleaseciteitassuch:
Roodman,D.2009.Howtodoxtabond2:Anintroductiontodifference
andsystemGMMinStata.StataJournal9(1):86136.

Options

level(#)specifiestheconfidencelevel,inpercent,forconfidence
intervalsofthecoefficients;seehelplevel.Thedefaultis95.

svmattellsxtabond2tosavetheX,Y,Z,H,andweightmatricesase()
returnmacros.Thesearenotincludedbydefaultbecausethematrices
canbelargerthanthedatasetitself.Ifthepcaoptionisused,
svmatwillalsosavetheeigenvectorsmatrixas
xtabond2_eigenvectors.Thisoptionisavailableonlywhenusingusing
theMataimplementationinMata'sspeedfavoringmode.Dataare
storedinbalancedmatricesandsortedbyindividual,equation(for
SystemGMM),thentime.Rowsandcolumnsarelabelledforclarity.
Theinstrumentmatrixtypicallycontainsallzerocolumns,whichdo
notaffectestimation.ForcompatibilitywithStatacolumnlabeling
conventions,instrumentssubjecttothebackwardorthogonal
deviationstransform(seebelow)arestilldenotedwitha"D."
operator.

twostepspecifiesthatthetwostepestimatoristobecalculatedinstead
oftheonestep.

robust:Foronestepestimation,robustspecifiesthattherobust
estimatorofthecovariancematrixoftheparameterestimatesbe
calculated.Theresultingstandarderrorestimatesareconsistentin
thepresenceofanypatternofheteroskedasticityandautocorrelation
withinpanels.Intwostepestimation,thestandardcovariance
matrixisalreadyrobustintheorybuttypicallyyieldsstandard
errorsthataredownwardbiased.twosteprobustrequests
Windmeijersfinitesamplecorrectionforthetwostepcovariance
matrix.

cluster(varname)overridesthedefaultuseofthepanelidentifier(as
setbytsset)asthebasisfordefininggroups.cluster(varname)
impliesrobustinthesensesjustdescribed.Forexample,intwostep
estimation,itrequeststheWindmeijercorrection.Changingthegroup
identifierwiththisoptionaffectsonestep"robust"standard
errors,alltwostepresults,theHansenanddifferenceinHansen
tests,andtheArellanoBondserialcorrelationtests.

noconstantsuppressestheconstantterminthelevelsequation.By
default,thetermisincludedasaregressorandIVstyleinstrument.
UnlikextabondandDPD(theoriginalimplementationofthese
estimators),xtabond2doesnotincludetheconstantterminthe
transformedequationindifferenceGMM.Rather,theconstantis
transformedout.

smallrequestststatisticsinsteadofzstatisticsandanFtestinstead
ofaWaldchisquaredtestofoverallmodelfit.
http://repec.org/bocode/x/xtabond2.html 5/13
5/6/2017 repec.org/bocode/x/xtabond2.html

noleveleqspecifiesthatlevelequationshouldbeexcludedfromthe
estimation,yieldingdifferenceratherthansystemGMM.

nodiffsarganpreventsdifferenceinSargan/Hansentests,whichareare
computationallyintensivesincetheyinvolvereestimatingthemodel
foreachtest.Theoptionhasnoeffectontheadoversionof
xtabond2,whichdoesnotperformdifferenceinSargan/Hansentesting
anyway.

nomatapreventstheuseofMatacodeevenwhenthelanguageisavailable
(inStata10.0orlater).ItisnotnecessaryinStata79.
Ordinarilythisswitchdoesnotaffectresults.However,ifsome
variablesarecollinearornearlyso,thetwoversionsoftheprogram
maydroppeddifferentones,whichcanaffecttheresults.Theycan
evendifferinhowmanytheydrop,sincetheversionsusedifferent
routinesandtolerancesfordeterminingcollinearity.Inaddition,
theMataversiondoesnotperfectlyhandlestrangeandunusual
expressionslikegmm(L.x,lag(11)).(Documentationforthe
gmmstyle()optionisbelow.)Thisexpressionisthesameasgmm(x,
lag(00))inprinciple.ButtheMatacodewouldinterpretitby
laggingx,thuslosingtheobservationsofxfort=T,thenunlagging
theremaininginformation.Theslow,adoversionwouldnotlosedata
inthisway.

orthogonalrequeststheforwardorthogonaldeviationstransforminstead
ofdifferencing.

ivstyle()specifiesasetofvariablestoserveasstandardinstruments,
withonecolumnintheinstrumentmatrixpervariable.Normally,
strictlyexogenousregressorsareincludedinivstyleoptions,in
ordertoentertheinstrumentmatrix,aswellasbeinglistedbefore
themaincommaofthecommandline.Theequation()suboption
specifieswhichequation(s)shouldusetheinstruments:
firstdifferenceonly(equation(diff)),levelsonly
(equation(level)),orboth(equation(both)),thedefault.Alsoby
default,theinstrumentsaretransformed(intodifferencesor
orthogonaldeviations)foruseinthetransformedequationand
entereduntransformedforthelevelsequation.Thesuboption
passthrumaybeusedafterequation(diff),orwhentheoption
noleveleqisinvoked,topreventthistransformation.equation()is
usefulforproperhandlingofpredeterminedvariablesusedas
IVstyleinstrumentsinsystemGMM.Forexample,ifxis
predetermined,itisavalidinstrumentforthelevelsequationsince
itisassumedtobeuncorrelatedwiththecontemporaneouserrorterm.
However,xbecomesendogenousinfirstdifferences,soD.xisnota
validinstrumentforthetransformedequation.ivstyle(x)would
thereforebeinappropriate.TheuseofxasanIVstyleinstrument
inlevelsonlycouldbespecifiedbyiv(x,eq(level)).

Ifthesuboptionmzisincludedinanivstyleoption,missingvalues
intheinstrumentsareconvertedtozeroes.mzdoesnotchangethe
precisemomentconditionsgeneratedbyivstyletheystillapplyonly
totheerrortermsofobservationswhichhavedataforthe
instruments.Rather,mzallowsobservationsthataremissingdata
fortheinstrumentsinquestiontononethelessstayintheregression
iftheinstrumentsarenotalsoregressors.(Observationsmissing
valuesforregressorsmuststillbedropped.)

gmmstyle()specifiesasetofvariablestobeusedasbasesfor
http://repec.org/bocode/x/xtabond2.html 6/13
5/6/2017 repec.org/bocode/x/xtabond2.html

"GMMstyle"instrumentsetsdescribedinHoltzEakin,Newey,and
Rosen(1988)andArellanoandBond(1991).Bydefaultxtabond2uses,
foreachtimeperiod,allavailablelagsofthespecifiedvariables
inlevelsdatedt1orearlierasinstrumentsforthetransformed
equation;andusesthecontemporaneousfirstdifferencesas
instrumentsinthelevelsequation.Thesedefaultsareappropriate
forpredeterminedvariablesthatarenotstrictlyexogenous(Bond
2000).Missingvaluesarealwaysreplacedbyzeros.Theoptional
laglimits(ab)suboptioncanoverridethesedefaults:forthe
transformedequation,laggedlevelsdatedtatotbareusedas
instruments,whileforthelevelsequation,thefirstdifference
datedta+1isnormallyused.aandbcaneachbemissing(".");a
defaultsto1andbtoinfinity.Theycanevenbenegative,implying
"forward"lags.Ifa>bthenxtabond2swapstheirvalues.(Notethat
ifa<=b<0thenthefirstdifferencedatedtb+1isnormallyusedas
aninstrumentinthelevelsequationinsteadofthatdatedta+1,
becauseitismorefrequentlyintherange[1,T]ofvalidtime
indexes.Or,forthesamereasons,ifa<=0<=borb<=0<=a,the
firstdifferencedatedtisused.)Sincethegmmstyle()varlist
allowstimeseriesoperators,therearemanyroutestothesame
specification.E.g.,gmm(w,lag(2.)),thestandardtreatmentforan
endogenousvariable,isequivalenttogmm(L.w,lag(1.)),thus
gmm(L.w).

Theequation()suboptionofgmmstyle()worksmuchlikethatof
ivstyle()(seeabove),withoneimportantexception.Inresponseto
equation(level),xtabond2generatesthefullsetofavailable
instrumentsforthelevelsequationsinceitisnolongerthecase
thatmostaremademathematicallyredundantbythepresenceofthe
fullsetofmomentconditionsforthetransformedequation.Tobe
precise,ifthelaglimitsareaandb,thenlagsofthespecified
variablesindifferencesdatedtbtotaareused.equation(diff)
hasnoeffectindifferenceGMM.

Thepassthrusuboptionofgmmstyle()ismeaningfulonlyinsystem
GMM,andonlyforvariablesforwhichequation(level)hasalsobeen
specified.Itdirectsxtabond2tocreateinstrumentsforthelevels
equationthatusenotthefirstdifferencesofthespecified
variablesbuttheoriginallevelsofthesamedates.Forexample,
equation(level)passthrulaglimits(1.)requeststhatalllagged
levelsbeusedasinstruments.Underthestandardassumptions,these
instrumentsarenotvalid.

Theorthogonalsuboptiontellsxtabond2toapplythebackward
orthogonaldeviationstransformtotheinstrumentsforthe
transformedequation.Essentially,instrumentsarereplacedwith
theirdeviationsfrompastmeans.Sincetheresultinginstruments
dependonallpastvaluesoftheunderlyingvariables,theregressors
inthetransformedequationshouldnotbesimilarlytransformed.
Otherwisetheinstrumentsmaybecorrelatedwiththeerror.Thatis,
ifthissuboptionisusedtheorthogonaloptionshouldalsobe
included(outsideagmmstyle()option).Insimulations,Hayakawa
(2009)findsthat"DifferenceGMM"withthiscombinationbackword
orthogonaldeviationsfortheinsturmentsandforwardforthe
regressorsislessbiasedandmorestablethantraditional
DifferenceGMMforastandardAR(1)modelwhenT>=10.(ForanAR(p)
model,heusesonlythemostrecentpinstrumentlags,equivalentto
gmm(L.y,orthoglag(1p)).)Thisoptiondoesnotaffecthe
instrumentsforthelevelsequation.

Thesplitsuboptionofgmmstyle()isalsomeaningfulonlyinsystem

http://repec.org/bocode/x/xtabond2.html 7/13
5/6/2017 repec.org/bocode/x/xtabond2.html

GMM,andthenonlywhenneithereq(diff)noreq(level)isspecified.
Itssoleeffectistosplitthespecifiedinstrumentgroupintwofor
purposesofdifferenceinSargan/Hansentestingoneinstrumentset
forthetransformedequationandoneforthelevelsequation.

Thecollapsesuboptionofgmmstyle()specifiesthatxtabond2should
createoneinstrumentforeachvariableandlagdistance,ratherthan
oneforeachtimeperiod,variable,andlagdistance.Inlarge
samples,collapsereducesstatisticalefficiency.Butinsmall
samplesitcanavoidthebiasthatarisesasthenumberof
instrumentsclimbstowardthenumberofobservations.(When
instrumentsaremany,theytendtooverfittheinstrumentedvariables
andbiastheresultstowardthoseofOLS/GLS.)collapsealsogreatly
curtailscomputationaldemandsbyreducingthewidthofthe
instrumentmatrix,and(relevantfortheadoversionoftheprogram)
helpskeepthematrixwithinStata'ssizelimit.

Forexample,ifamodelassumesthatE[w_is*D.e_it]=0foralls<t,
thisisexpressedinstandardArellanoBondestimationas:

sum_i(w_is*D.e_it)=0foreachsandt,s<t.

Thistranslatesintocolumnsintheinstrumentmatrixoftheform:

w_i100000...
0w_i1w_i2000...
000w_i1w_i2w_i3...
.........
.........

collapsedividesthe"GMMstyle"momentconditionsintogroupsand
sumstheconditionsineachgrouptoformasmallersetofconditions
oftheform:

sum_i,t(w_i,tj*D.e_it)=0foreachj>0.

Thisisequivalenttocombiningcolumnsoftheinstrumentmatrixby
addition,yielding:

w_i100...
w_i2w_i10...
w_i3w_i2w_i1...
......
......

Similarly,thestandardinstrumentsforthelevelsequation(in
systemGMM)collapsefrom:

D.w_i200...
0D.w_i30...
00D.w_i4...
......

Tothesinglecolumn:

http://repec.org/bocode/x/xtabond2.html 8/13
5/6/2017 repec.org/bocode/x/xtabond2.html

D.w_i2
D.w_i3
D.w_i4
.
.

pcatellsxtabond2toreplacethe"GMMstyle"instrumentswiththeir
principalcomponentsinordertoreducetheinstrumentcountina
minimallyarbitraryway(KapetaniosandMarcellino2010;BaiandNg
2010;Mehrhoff2009).Principalcomponentsanalysisisrunonthe
correlation,notcovariance,matrixofthe"GMMstyle"instruments.
Bydefaultxtabond2willselectallcomponentswitheigenvaluesat
least1,andwillselectmoreifnecessarytoguaranteethat
instrumentsareatleastasnumerousasregressors,favoringthose
withlargesteigenvalues.

components(#)allowstheusertooverridethedefaultnumberof
componentsdescribedjustabove.

artests(#)specifiesthemaximumorderoftheautocorrelationteststobe
reported.Thedefaultis2.

arlevelsspecifiesthattheautocorrelationtestsshouldbeappliedto
theresidualsfromthelevels,notfirstdifference,equation.It
cannotbespecifiedalongwithnoleveleq.Iftherearefixed
effects,thenautocorrelationinlevelsisexpectedandwouldnot
callthespecificationintothequestion.

h(#)controlstheformofH,theaprioriestimateofthecovariance
matrixoftheidiosyncraticerrors.InonesteplinearGMM,the
inverseofZ'HZ,whereZistheinstrumentmatrix,proxiesforthe
covariancematrixofthemoments,andisusedtoweightthesample
momentswhosemagnitudesarejointlyminimized.SinceHmerely
controlstheweightsoninstrumentsbelievedexogenous,forany
nondegeneratechoiceofH,onestepestimateswillbeconsistent.
Andtwostepestimateswillbeasymptoticallyefficient(Baum,
Schaffer,andStillman2003).SothepriorityindesigningHis
minimizingarbitrariness.Halwayshasblockdiagonalform,withall
blocksthesame.Let*indicatevariablestransformedbyorthogonal
deviationsordifferencingandMbethe(T1)xTmatrixthatperforms
thechosentransform.WeassumeforthepurposesofdesigningHthat
var[e]=I,theidentitymatrix.Then,fordifferenceGMM,the
(T1)x(T1)blocksofHbydefaultareMM',whichisvar[u*]
(=var[e*])whenvar[e]=I(seeRoodman2009).Fororthogonal
deviations,MM'=I.Fordifferencing,itis:

210...
121...
012...
......

ToperformsystemGMM,xtabond2treatsthetransformeddataasbeing
forperiods2toTandlevelsdataasbeingforperiodsT+1to2T.
TheblocksofHarethen(2T1)x(2T1)aprioriestimatesofthe
covarianceofthecompoundvector[u*'u']'.Ifweassume,in
additiontovar[e]=I,thatvar[v]=0(nofixedeffects),thenthe
blocksofHare

http://repec.org/bocode/x/xtabond2.html 9/13
5/6/2017 repec.org/bocode/x/xtabond2.html

MM'M'
MI

However,morethanonechoiceforHispresentintheliterature.In
xtabond2,h(3),thedefault,specifiesthematricesdescribedabove.
h(2)differsinthatforsystemGMMtheupperrightandlowerleft
quadrantsofthedepictedHarezeroedout.Thiscopiescurrent
versionsofDPDforGaussandOx(ArellanoandBond1998;Doornik,
Arellano,andBond2002).h(1)specifiesthatH=Iforbothdifference
andsystemGMM.Htookthisvalueintheoriginalimplementationof
thesystemGMMestimator,inBlundellandBond(1998).Inonestep
GMM,settingH=Iessentiallygives2SLS.

TheMatasystemparametermatafavorinfluencesthebehavioroftheMata
versionofxtabond2.Typemata:matasetmatafavorspeedormata:
matasetmatafavorspacebeforerunningxtabond2toinfluencethe
tradeoffitmakesbetweenspeedandmemoryuse.Addthe,perm
optiontothesecommandstomakethechangepermanent.Note:
IncreasingtheamountofmemoryavailableforStatadatasetsusing
thesetmemorycommandreducesthatavailabletoMata.SoifMata
xtabond2isrunningoutofmemory,usuallyindicatedbyanunableto
allocaterealmessage,alsotryreducingStatamemorywithset
memory.

Optionsforpredict

xb,thedefault,calculatesthelinearprediction.

residualscalculatestheresidualerrorofthedependentvariablefrom
thelinearprediction.

differencerequeststhatthefirstdifferencesofthedependentvariable,
ratherthanthelevels,bepredicted.

Returnvalues

Scalars
e(N)Numberofcompleteobservationsinuntransformeddata
>(systemGMM)ortransformeddata(differenceGMM)
e(sargan)Sarganstatistic
e(sar_df)DegreesoffreedomforSarganstatistic
e(sarganp)pvalueofSarganstatistic
e(hansen)HansenJstatistic
e(hansen_df)DegreesoffreedomforHansenstatistic
e(hansenp)pvalueofHansenstatistic
e(artests)NumberofARtestsrequested
e(ari)AR(i)teststatistic
e(arip)pvalueofAR(i)statistic
e(df_m)Modeldegreesoffreedom
e(df_r)Residualdegreesoffreedom(ifsmallspecified)
e(chi2)Waldchisquaredstatistic(ifsmallnotspecified)
e(chi2p)pvalueofWaldstatistic(ifsmallnotspecified)
e(sig2)Estimatedvarianceofthee_it

http://repec.org/bocode/x/xtabond2.html 10/13
5/6/2017 repec.org/bocode/x/xtabond2.html

e(sigma)Squarerootthereof
e(F)Fstatistic(ifsmallspecified)
e(F_p)pvalueofFstatistic(ifsmallspecified)
e(g_min)Lowestnumberofobservationsinanincludedindividu
>al
e(g_max)Highestnumberofobservationsinanincludedindivid
>ual
e(g_avg)Averagenumberofobservationsperincludedindividua
>l
e(h)Valueofh()option(defaultis3)
e(j)Numberofinstruments
e(j0)Numberofinstruments,includingcollinearones
e(N_g)Numberofincludedindividuals
e(N_clust)Numberofclusters
e(components)Numberofcomponentsextractedifpcaoptioninvoked
e(kmo)KaiserMeyerOlkinmeasureofsamplingadequacyifpc
>aoptioninvoked
e(pcaR2)Sumofeigenvaluesofincludedcomponentsdividedby
>sumofall

Macros
e(predict)"xtab2_p"
e(artype)"firstdifferences"or"levels"
e(vcetype)"Robust"foronesteprobust,"Corrected"fortwostep
>robust,emptyotherwise
e(twostep)"twostep"fortwostep
e(small)"small"forsmall
e(esttype)"system"or"difference"
e(pca)"pca"ifpcaoptioninvoked
e(gmminstsi)Variableslistedingmmstylegroupi
e(ivinstsi)Variableslistedinivstylegroupi
e(transform)"firstdifferences"or"orthogonaldeviations"
e(depvar)Dependentvariable
e(clustvar)Clusteringgroupidentifier
e(tvar)Timevariable
e(ivar)Individual(panel)variable
e(cmd)"xtabond2"
e(cmdline)Fullcommandline
e(diffgroupi)variablesinithgroupsubjecttodifferenceSargan/H
>ansentesting

Matrices
e(b)Coefficientvector
e(V)Variancecovariancematrix
e(A1)FirststepGMMweightingmatrix
e(A2)SecondstepGMMweightingmatrix(iftwostepspecifie
>d)
e(Ze)Z'EwhereE=2ndstepresiduals,usedincomputingHan
>senstatistic
e(eigenvalues)EigenvaluesofprincipalcomponentsofGMMstyleinst
>ruments(ifpcaspecified)
e(diffsargan)TableofdifferenceinSargan/Hansentests
e(ivequation)Valueofequation()suboptionforeachivstyle()opti
>on,inorder
(0=level,1=diff,2=both)
e(ivpassthru)Valueofpassthruoptionforeachivstyle()option.
e(ivmz)Valueofmzsuboptionforeachivstyle()option
e(gmmequation)Valueofequation()suboptionforeachgmmstyle()opt
>ion
(0=level,1=diff,2=both)
e(gmmpassthru)Valueofpassthruoptionforeachgmmstyle()option
e(gmmpasscollapse)Valueofcollapseoptionforeachgmmstyle()option
e(gmmlaglimits)Laglimitsforeachgmmstyle()option
http://repec.org/bocode/x/xtabond2.html 11/13
5/6/2017 repec.org/bocode/x/xtabond2.html

e(gmmorthogonal)Valueoforthogonaloptionforeachgmmstyle()option
e(X)Matrixofrightsidevariablesusedinestimation,if
>svmatinvoked
e(Y)Columnofdependentvariableusedinestimation,ifs
>vmatinvoked
e(Z)Instrumentmatrixusedinestimation,ifsvmatinvoke
>d
e(H)Hmatrixusedinestimation,ifsvmatinvoked
e(wt)Weightvectorusedinestimation,ifsvmatinvokedan
>dweightsused
e(eigenvectors)Principalcomponentscores,ifsvmatandpcainvoked

Functions
e(sample)Marksestimationsample

Examples

usehttp://www.statapress.com/data/r7/abdata.dta
xtabond2nl.nl(0/1).(wk)yr1980yr1984,gmm(l.nwk)iv(yr1980yr1984,
passthru)noleveleqsmall
xtabond2nl.nl(0/1).(wk)yr1980yr1984,gmm(l.nwk)iv(yr1980yr1984,
mz)robusttwostepsmallh(2)
xtabond2nl(1/2).nl(0/1).wl(0/2).(kys)yr1980yr1984,gmm(l.nwk)
iv(yr1980yr1984)robusttwostepsmall
*Nexttwoareequivalent,assumingidisthepanelidentifier
ivreg2ncap(w=kysrec)[pw=_n],cluster(ind)orthog(rec)
xtabond2nwcap[pw=_n],iv(capkys,eq(level))iv(rec,eq(level))
cluster(ind)h(1)
*Samefornexttwo
regressnwk
xtabond2nwk,iv(wk,eq(level))smallh(1)
*Andnexttwo,assumingxtabondupdatedsinceMay2004withupdate
command.
xtabondnyr*,lags(1)pre(w,lags(1,.))pre(k,endog)robustsmall
noconstant
xtabond2nL.nwL.wkyr*,gmm(L.(wnk))iv(yr*)noleveleqrobustsmall
*Andnexttwo
xtdpdnL.nL(0/1).(wk)yr1978yr1984,dgmm(wkn)lgmm(wkn)
liv(yr1978yr1984)vce(robust)twohascons
xtabond2nL.nL(0/1).(wk)yr1978yr1984,gmm(L.(wkn))
iv(yr1978yr1984,eq(level))h(2)robusttwostep
*Threewaystoreducetheinstrumentcount
xtabond2nL.nL(0/1).(wk)yr1978yr1984,gmm(L.(wkn))
iv(yr1978yr1984,eq(level))h(2)robusttwosteppca
xtabond2nL.nL(0/1).(wk)yr1978yr1984,gmm(L.(wkn),collapse)
iv(yr1978yr1984,eq(level))h(2)robusttwostep
xtabond2nL.nL(0/1).(wk)yr1978yr1984,gmm(L.(wkn),lag(11))
iv(yr1978yr1984,eq(level))h(2)robusttwostep
*EstimationalaHayakawa2009
xtabond2nL.nL(0/1).(wk)yr1979yr1984,gmm(L.(wkn),lag(11)
orthog)iv(yr1979yr1984,eq(level))h(2)robusttwosteporthog
noleveleq

Threesamplefilesareincludedwiththepackagedownloadedwiththis
command.abest.doreproducestwosamplefilethatcomeswithDPDforOx,
whichinturngeneratemostoftheGMMresultsinArellanoandBond
(1991).bbest.doreproducesanothersamplefilethatcomeswithDPDfor
Ox,basedonBlundellandBond(1998).Todownloadthem,typethe
followingcommandorclickonit:sscinstallxtabond2,allreplace.
Thiswillsavethefilestoyourcurrentdirectory,assetbythecd
command.greene.doreproducesanexampleinGreene(2002).

http://repec.org/bocode/x/xtabond2.html 12/13
5/6/2017 repec.org/bocode/x/xtabond2.html


References

Arellano,M.andS.Bond.1991.Sometestsofspecificationforpanel
data:MonteCarloevidenceandanapplicationtoemployment
equations.TheReviewofEconomicStudies58:27797.
Arellano,M.andS.Bond.1998.DynamicPaneldataestimationusing
DPD98forGauss:Aguideforusers.
Arellano,M.andO.Bover.1995.Anotherlookattheinstrumental
variableestimationoferrorcomponentsmodels.Journalof
Econometrics68:2951.
Bai,J.,andS.Ng.2010.InstrumentalVariablesEstimationinaData
RichEnvironment.EconometricTheory26(6):15771606.
Baum,C.F.,M.E.Schaffer,andS.Stillman.2003.Instrumentalvariables
andGMM:Estimationandtesting.StataJournal3:131.
Blundell,R.,andS.Bond.1998.Initialconditionsandmoment
restrictionsindynamicpaneldatamodels.JournalofEconometrics
87:11543.
Bond,S.2002.Dynamicpaneldatamodels:Aguidetomicrodatamethods
andpractice.WorkingPaper09/02.InstituteforFiscalStudies,
London.
Doornik,J.A.,M.Arellano,andS.Bond.2002.Paneldataestimation
usingDPDforOx.http://www.nuff.ox.ac.uk/Users/Doornik.
Greene,W.H.2002EconometricAnalysis,5thed.PrenticeHall.
Hayakawa,K.2009.Asimpleefficientinstrumentalvariableestimatorfor
panelAR(p)modelswhenbothNandTarelarge.EconometricTheory
25:87390.
HoltzEakin,D.,W.Newey,andH.S.Rosen.1988.Estimatingvector
autoregressionswithpaneldata.Econometrica56:137195.
Kapetanios,G.,M.Marcellino.2010.FactorGMMestimationwithlarge
setsofpossiblyweakinstruments.ComputationalStatistics&Data
Analysis54(11):265575.
Mehrhoff,J.2009.Asolutiontotheproblemoftoomanyinstrumentsin
dynamicpaneldataGMM.DiscussionPaperSeries1.No31/2009.
Roodman,D.2009.HowtoDoxtabond2:AnIntroductionto"Difference"and
"System"GMMinStata.StataJournal9(1):86136.
Windmeijer,F.2005.Afinitesamplecorrectionforthevarianceof
linearefficienttwostepGMMestimators.JournalofEconometrics
126:2551.

Author

DavidRoodman
SeniorFellow
CenterforGlobalDevelopment
Washington,DC
[email protected]

Alsosee

Manual:[U]23Estimationandpostestimationcommands,
[U]29OverviewofStataestimationcommands,
[XT]xtabond

Online:helpforxtabond,ivreg,ivreg2,estcom,postest;xtgee,

http://repec.org/bocode/x/xtabond2.html 13/13

You might also like