Titlestata.
comivregress—Single-equationinstrumental-variablesregressionDescriptionQuickstartMenuSyntaxOptionsRemarksandexamplesStoredresultsMethodsandformulasReferencesAlsoseeDescriptionivregresstslinearmodelswhereoneormoreoftheregressorsareendogenouslydetermined.
ivregresssupportsestimationviatwo-stageleastsquares(2SLS),limited-informationmaximumlikelihood(LIML),andgeneralizedmethodofmoments(GMM).
Quickstart2SLSestimationofalinearregressionofy1onx1andendogenousregressory2thatisinstrumentedbyz1ivregress2slsy1x1(y2=z1)Asabove,butwithtwoendogenousregressors,y2andy3instrumentedbyz1andz2ivregress2slsy1x1(y2y3=z1z2)Withrobuststandarderrorsivregress2slsy1x1(y2y3=z1z2),vce(robust)Reportsmall-samplestatisticsivregress2slsy1x1(y2y3=z1z2),smallUseLIMLestimationivregresslimly1x1(y2y3=z1z2)UseGMMestimationivregressgmmy1x1(y2y3=z1z2)Alsospecifyaweightingmatrixthatallowsforcorrelationwithinclustersidentiedbycvarivregressgmmy1x1(y2y3=z1z2),wmatrix(clustercvar)MenuStatistics>Endogenouscovariates>Linearregressionwithendogenouscovariates12ivregress—Single-equationinstrumental-variablesregressionSyntaxivregressestimatordepvarvarlist1(varlist2=varlistiv)ifinweight,optionsvarlist1isthelistofexogenousvariables.
varlist2isthelistofendogenousvariables.
varlistivisthelistofexogenousvariablesusedwithvarlist1asinstrumentsforvarlist2.
estimatorDescription2slstwo-stageleastsquares(2SLS)limllimited-informationmaximumlikelihood(LIML)gmmgeneralizedmethodofmoments(GMM)optionsDescriptionModelnoconstantsuppressconstanttermhasconshasuser-suppliedconstantGMM1wmatrix(wmtype)wmtypemayberobust,clusterclustvar,hackernel,orunadjustedcentercentermomentsinweightmatrixcomputationigmmuseiterativeinsteadoftwo-stepGMMestimatoreps(#)2specify#forparameterconvergencecriterion;defaultiseps(1e-6)weps(#)2specify#forweightmatrixconvergencecriterion;defaultisweps(1e-6)optimizationoptions2controltheoptimizationprocess;seldomusedSE/Robustvce(vcetype)vcetypemaybeunadjusted,robust,clusterclustvar,bootstrap,jackknife,orhackernelReportinglevel(#)setcondencelevel;defaultislevel(95)firstreportrst-stageregressionsmallmakedegrees-of-freedomadjustmentsandreportsmall-samplestatisticsnoheaderdisplayonlythecoefcienttabledepname(depname)substitutedependentvariablenameeform(string)reportexponentiatedcoefcientsandusestringtolabelthemdisplayoptionscontrolcolumnsandcolumnformats,rowspacing,linewidth,displayofomittedvariablesandbaseandemptycells,andfactor-variablelabelingivregress—Single-equationinstrumental-variablesregression3perfectdonotcheckforcollinearitybetweenendogenousregressorsandexcludedinstrumentscoeflegenddisplaylegendinsteadofstatistics1Theseoptionsmaybespeciedonlywhengmmisspecied.
2Theseoptionsmaybespeciedonlywhenigmmisspecied.
varlist1,varlist2,andvarlistivmaycontainfactorvariables;see[U]11.
4.
3Factorvariables.
depvar,varlist1,varlist2,andvarlistivmaycontaintime-seriesoperators;see[U]11.
4.
4Time-seriesvarlists.
bootstrap,by,fmm,jackknife,rolling,statsby,andsvyareallowed;see[U]11.
1.
10Prexcommands.
Formoredetails,see[FMM]fmm:ivregress.
Weightsarenotallowedwiththebootstrapprex;see[R]bootstrap.
aweightsarenotallowedwiththejackknifeprex;see[R]jackknife.
hascons,vce(),noheader,depname(),andweightsarenotallowedwiththesvyprex;see[SVY]svy.
aweights,fweights,iweights,andpweightsareallowed;see[U]11.
1.
6weight.
perfectandcoeflegenddonotappearinthedialogbox.
See[U]20Estimationandpostestimationcommandsformorecapabilitiesofestimationcommands.
OptionsModelnoconstant;see[R]Estimationoptions.
hasconsindicatesthatauser-denedconstantoritsequivalentisspeciedamongtheindependentvariables.
GMMwmatrix(wmtype)speciesthetypeofweightingmatrixtobeusedinconjunctionwiththeGMMestimator.
Specifyingwmatrix(robust)requestsaweightingmatrixthatisoptimalwhentheerrortermisheteroskedastic.
wmatrix(robust)isthedefault.
Specifyingwmatrix(clusterclustvar)requestsaweightingmatrixthataccountsforarbitrarycorrelationamongobservationswithinclustersidentiedbyclustvar.
Specifyingwmatrix(hackernel#)requestsaheteroskedasticity-andautocorrelation-consistent(HAC)weightingmatrixusingthespeciedkernel(seebelow)with#lags.
Thebandwidthofakernelisequalto#+1.
Specifyingwmatrix(hackernelopt#)requestsanHACweightingmatrixusingthespeciedkernel,andthelagorderisselectedusingNeweyandWest's(1994)optimallag-selectionalgorithm.
#isanoptionaltuningparameterthataffectsthelagorderselected;seethediscussioninMethodsandformulas.
Specifyingwmatrix(hackernel)requestsanHACweightingmatrixusingthespeciedkernelandN2lags,whereNisthesamplesize.
TherearethreekernelsavailableforHACweightingmatrices,andyoumayrequesteachonebyusingthenameusedbystatisticiansorthenameperhapsmorefamiliartoeconomists:bartlettornwestrequeststheBartlett(Newey–West)kernel;parzenorgallantrequeststheParzen(Gallant1987)kernel;andquadraticspectralorandrewsrequeststhequadraticspectral(Andrews1991)kernel.
4ivregress—Single-equationinstrumental-variablesregressionSpecifyingwmatrix(unadjusted)requestsaweightingmatrixthatissuitablewhentheerrorsarehomoskedastic.
TheGMMestimatorwiththisweightingmatrixisequivalenttothe2SLSestimator.
centerrequeststhatthesamplemomentsbecentered(demeaned)whencomputingGMMweightmatrices.
Bydefault,centeringisnotdone.
igmmrequeststhattheiterativeGMMestimatorbeusedinsteadofthedefaulttwo-stepGMMestimator.
Convergenceisdeclaredwhentherelativechangeintheparametervectorfromoneiterationtothenextislessthaneps()ortherelativechangeintheweightmatrixislessthanweps().
eps(#)speciestheconvergencecriterionforsuccessiveparameterestimateswhentheiterativeGMMestimatorisused.
Thedefaultiseps(1e-6).
Convergenceisdeclaredwhentherelativedifferencebetweensuccessiveparameterestimatesislessthaneps()andtherelativedifferencebetweensuccessiveestimatesoftheweightingmatrixislessthanweps().
weps(#)speciestheconvergencecriterionforsuccessiveestimatesoftheweightingmatrixwhentheiterativeGMMestimatorisused.
Thedefaultisweps(1e-6).
Convergenceisdeclaredwhentherelativedifferencebetweensuccessiveparameterestimatesislessthaneps()andtherelativedifferencebetweensuccessiveestimatesoftheweightingmatrixislessthanweps().
optimizationoptions:iterate(#),nolog.
iterate()speciesthemaximumnumberofiterationstoperforminconjunctionwiththeiterativeGMMestimator.
Thedefaultisthenumbersetusingsetmaxiter,whichis300bydefault.
log/nologspecieswhethertoshowtheiterationlog;seesetiterlogin[R]setiter.
Theseoptionsareseldomused.
SE/Robustvce(vcetype)speciesthetypeofstandarderrorreported,whichincludestypesthatarerobusttosomekindsofmisspecication(robust),thatallowforintragroupcorrelation(clusterclustvar),andthatusebootstraporjackknifemethods(bootstrap,jackknife);see[R]vceoption.
vce(unadjusted),thedefaultfor2slsandliml,speciesthatanunadjusted(nonrobust)VCEmatrixbeused.
Thedefaultforgmmisbasedonthewmtypespeciedinthewmatrix()option;seewmatrix(wmtype)above.
Ifwmatrix()isspeciedwithgmmbutvce()isnot,thenvcetypeissetequaltowmtype.
Tooverridethisbehaviorandobtainanunadjusted(nonrobust)VCEmatrix,specifyvce(unadjusted).
ivregressalsoallowsthefollowing:vce(hackernel#|opt#)speciesthatanHACcovariancematrixbeused.
Thesyntaxusedwithvce(hackernel.
.
.
)isidenticaltothatusedwithwmatrix(hackernel.
.
.
);seewmatrix(wmtype)above.
Reportinglevel(#);see[R]Estimationoptions.
firstrequeststhattherst-stageregressionresultsbedisplayed.
smallrequeststhatthedegrees-of-freedomadjustmentN/(Nk)bemadetothevariance–covariancematrixofparametersandthatsmall-sampleFandtstatisticsbereported,whereNisthesamplesizeandkisthenumberofparametersestimated.
Bydefault,nodegrees-of-freedomadjustmentismade,andWaldandzstatisticsarereported.
Evenwiththisoption,nodegrees-of-freedomadjustmentismadetotheweightingmatrixwhentheGMMestimatorisused.
noheadersuppressesthedisplayofthesummarystatisticsatthetopoftheoutput,displayingonlythecoefcienttable.
ivregress—Single-equationinstrumental-variablesregression5depname(depname)isusedonlyinprogramsandado-lesthatuseivregresstotmodelsotherthaninstrumental-variablesregression.
depname()maybespeciedonlyatestimationtime.
depnameisrecordedastheidentityofthedependentvariable,eventhoughtheestimatesarecalculatedusingdepvar.
Thismethodaffectsthelabelingoftheoutput—nottheresultscalculated—butcouldaffectlatercalculationsmadebypredict,wheretheresidualwouldbecalculatedasdeviationsfromdepnameratherthandepvar.
depname()ismosttypicallyusedwhendepvarisatemporaryvariable(see[P]macro)usedasaproxyfordepname.
eform(string)isusedonlyinprogramsandado-lesthatuseivregresstotmodelsotherthaninstrumental-variablesregression.
eform()speciesthatthecoefcienttablebedisplayedin"exponentiatedform",asdenedin[R]Maximize,andthatstringbeusedtolabeltheexponentiatedcoefcientsinthetable.
displayoptions:noci,nopvalues,noomitted,vsquish,noemptycells,baselevels,allbaselevels,nofvlabel,fvwrap(#),fvwrapon(style),cformat(%fmt),pformat(%fmt),sformat(%fmt),andnolstretch;see[R]Estimationoptions.
Thefollowingoptionsareavailablewithivregressbutarenotshowninthedialogbox:perfectrequeststhativregressnotcheckforcollinearitybetweentheendogenousregressorsandexcludedinstruments,allowingonetospecify"perfect"instruments.
ThisoptioncannotbeusedwiththeLIMLestimator.
Thisoptionmayberequiredwhenusingivregresstoimplementotherestimators.
coeflegend;see[R]Estimationoptions.
Remarksandexamplesstata.
comivregressperformsinstrumental-variablesregressionandweightedinstrumental-variablesregres-sion.
Forageneraldiscussionofinstrumentalvariables,seeBaum(2006),CameronandTrivedi(2005;2010,chap.
6)DavidsonandMacKinnon(1993),Greene(2018,chap.
8),andWooldridge(2010,2020).
SeeHall(2005)foralucidpresentationofGMMestimation.
AngristandPischke(2009,chap.
4)offeracasualyetthoroughintroductiontoinstrumental-variablesestimators,includingtheiruseinestimatingtreatmenteffects.
SomeoftheearliestworkonsimultaneoussystemscanbefoundinCowlesCommissionmonographs—KoopmansandMarschak(1950)andKoopmansandHood(1953)—withtherstdevelopmentsof2SLSappearinginTheil(1953)andBasmann(1957).
However,StockandWatson(2019,401–402)presentanexampleofthemethodofinstrumentalvariablesthatwasrstpublishedin1928byPhilipWright.
Thesyntaxforivregressassumesthatyouwanttotoneequationfromasystemofequationsoranequationforwhichyoudonotwanttospecifythefunctionalformfortheremainingequationsofthesystem.
Totafullsystemofequations,usingeither2SLSequation-by-equationorthree-stageleastsquares,see[R]reg3.
Anadvantageofivregressisthatyoucantoneequationofamultiple-equationsystemwithoutspecifyingthefunctionalformoftheremainingequations.
Formally,themodeltbyivregressisyi=yiβ1+x1iβ2+ui(1)yi=x1iΠ1+x2iΠ2+vi(2)Hereyiisthedependentvariablefortheithobservation,yirepresentstheendogenousregressors(varlist2inthesyntaxdiagram),x1irepresentstheincludedexogenousregressors(varlist1inthesyntaxdiagram),andx2irepresentstheexcludedexogenousregressors(varlistivinthesyntaxdiagram).
x1iandx2iarecollectivelycalledtheinstruments.
uiandviarezero-meanerrorterms,andthecorrelationsbetweenuiandtheelementsofviarepresumablynonzero.
6ivregress—Single-equationinstrumental-variablesregressionTherestofthediscussionispresentedunderthefollowingheadings:2SLSandLIMLestimatorsGMMestimatorVideoexample2SLSandLIMLestimatorsThemostcommoninstrumental-variablesestimatoris2SLS.
Example1:2SLSestimatorWehavestatedatafromthe1980censusonthemediandollarvalueofowner-occupiedhousing(hsngval)andthemedianmonthlygrossrent(rent).
Wewanttomodelrentasafunctionofhsngvalandthepercentageofthepopulationlivinginurbanareas(pcturban):renti=β0+β1hsngvali+β2pcturbani+uiwhereiindexesstatesanduiisanerrorterm.
Becauserandomshocksthataffectrentalratesinastateprobablyalsoaffecthousingvalues,wetreathsngvalasendogenous.
Webelievethatthecorrelationbetweenhsngvalanduisnotequaltozero.
Ontheotherhand,wehavenoreasontobelievethatthecorrelationbetweenpcturbananduisnonzero,soweassumethatpcturbanisexogenous.
Becausewearetreatinghsngvalasanendogenousregressor,wemusthaveoneormoreadditionalvariablesavailablethatarecorrelatedwithhsngvalbutuncorrelatedwithu.
Moreover,theseexcludedexogenousvariablesmustnotaffectrentdirectly,becauseiftheydothentheyshouldbeincludedintheregressionequationwespeciedabove.
Inourdataset,wehaveavariableforfamilyincome(faminc)andforregionofthecountry(region)thatwebelievearecorrelatedwithhsngvalbutnottheerrorterm.
Together,pcturban,faminc,andfactorvariables2.
region,3.
region,and4.
regionconstituteoursetofinstruments.
TottheequationinStata,wespecifythedependentvariableandthelistofincludedexogenousvariables.
Inparentheses,wespecifytheendogenousregressors,anequalsign,andtheexcludedexogenousvariables.
Onlytheadditionalexogenousvariablesmustbespeciedtotherightoftheequalsign;theexogenousvariablesthatappearintheregressionequationareautomaticallyincludedasinstruments.
Herewetourmodelwiththe2SLSestimator:.
usehttps://www.
stata-press.
com/data/r16/hsng(1980Censushousingdata).
ivregress2slsrentpcturban(hsngval=faminci.
region)Instrumentalvariables(2SLS)regressionNumberofobs=50Waldchi2(2)=90.
76Prob>chi2=0.
0000R-squared=0.
5989RootMSE=22.
166rentCoef.
Std.
Err.
zP>|z|[95%Conf.
Interval]hsngval.
0022398.
00032846.
820.
000.
0015961.
0028836pcturban.
081516.
29876520.
270.
785-.
504053.
667085_cons120.
706515.
228397.
930.
00090.
85942150.
5536Instrumented:hsngvalInstruments:pcturbanfaminc2.
region3.
region4.
regionivregress—Single-equationinstrumental-variablesregression7Aswewouldexpect,stateswithhigherhousingvalueshavehigherrentalrates.
Theproportionofastate'spopulationthatisurbandoesnothaveasignicanteffectonrents.
TechnicalnoteInasimultaneous-equationsframework,wecouldwritethemodelwejusttashsngvali=π0+π1faminci+π22.
regioni+π33.
regioni+π44.
regioni+virenti=β0+β1hsngvali+β2pcturbani+uiwhichherehappenstoberecursive(triangular),becausehsngvalappearsintheequationforrentbutrentdoesnotappearintheequationforhsngval.
Ingeneral,however,systemsofsimultaneousequationsarenotrecursive.
Becausethissystemisrecursive,wecouldtthetwoequationsindividuallyviaOLSifwewerewillingtoassumethatuandvwereindependent.
Foramoredetaileddiscussionoftriangularsystems,seeKmenta(1997,719–720).
Historically,instrumental-variablesestimationandsystemsofsimultaneousequationsweretaughtconcurrently,andoldertextbooksdescribeinstrumental-variablesestimationsolelyinthecontextofsimultaneousequations.
However,inrecentdecades,thetreatmentofendogeneityandinstrumental-variablesestimationhastakenonamuchbroaderscope,whileinterestinthespecicationofcompletesystemsofsimultaneousequationshaswaned.
Mostrecenttextbooks,suchasCameronandTrivedi(2005),DavidsonandMacKinnon(1993),andWooldridge(2010,2020),treatinstrumental-variablesestimationasanintegralpartofthemoderneconomists'toolkitandintroduceitlongbeforeshorterdiscussionsonsimultaneousequations.
Inadditiontothe2SLSmemberoftheκ-classestimators,ivregressimplementstheLIMLestimator.
BoththeoreticalandMonteCarloexercisesindicatethattheLIMLestimatormayyieldlessbiasandcondenceintervalswithbettercoverageratesthanthe2SLSestimator.
SeePoi(2006)andStock,Wright,andYogo(2002)(andthepaperscitedtherein)forMonteCarloevidence.
Example2:LIMLestimatorHereweretourmodelwiththeLIMLestimator:.
ivregresslimlrentpcturban(hsngval=faminci.
region)Instrumentalvariables(LIML)regressionNumberofobs=50Waldchi2(2)=75.
71Prob>chi2=0.
0000R-squared=0.
4901RootMSE=24.
992rentCoef.
Std.
Err.
zP>|z|[95%Conf.
Interval]hsngval.
0026686.
00041736.
390.
000.
0018507.
0034865pcturban-.
1827391.
3571132-0.
510.
609-.
8826681.
5171899_cons117.
608717.
226256.
830.
00083.
84587151.
3715Instrumented:hsngvalInstruments:pcturbanfaminc2.
region3.
region4.
regionTheseresultsarequalitativelysimilartothe2SLSresults,althoughthecoefcientonhsngvalisabout19%higher.
8ivregress—Single-equationinstrumental-variablesregressionGMMestimatorSincethecelebratedpaperofHansen(1982),theGMMhasbeenapopularmethodofestimationineconomicsandnance,anditlendsitselfwelltoinstrumental-variablesestimation.
ThebasicprincipleisthatwehavesomemomentororthogonalityconditionsoftheformE(ziui)=0(3)From(1),wehaveui=yiyiβ1x1iβ2.
WhataretheelementsoftheinstrumentvectorziByassumption,x1iisuncorrelatedwithui,asaretheexcludedexogenousvariablesx2i,andsoweusezi=[x1ix2i].
Themomentconditionsaresimplythemathematicalrepresentationoftheassumptionthattheinstrumentsareexogenous—thatis,theinstrumentsareorthogonalto(uncorrelatedwith)ui.
Ifthenumberofelementsinziisjustequaltothenumberofunknownparameters,thenwecanapplytheanalogyprincipleto(3)andsolve1Niziui=1Nizi(yiyiβ1x1iβ2)=0(4)Thisequationisknownasthemethodofmomentsestimator.
Here,wherethenumberofinstrumentsequalsthenumberofparameters,themethodofmomentsestimatorcoincideswiththe2SLSestimator,whichalsocoincideswithwhathashistoricallybeencalledtheindirectleast-squaresestimator(Judgeetal.
1985,595).
The"generalized"inGMMaddressesthecaseinwhichthenumberofinstruments(columnsofzi)exceedsthenumberofparameterstobeestimated.
Herethereisnouniquesolutiontothepopulationmomentconditionsdenedin(3),sowecannotuse(4).
Instead,wedenetheobjectivefunctionQ(β1,β2)=1NiziuiW1Niziui(5)whereWisapositive-denitematrixwiththesamenumberofrowsandcolumnsasthenumberofcolumnsofzi.
Wisknownastheweightingmatrix,andwespecifyitsstructurewiththewmatrix()option.
TheGMMestimatorof(β1,β2)minimizesQ(β1,β2);thatis,theGMMestimatorchoosesβ1andβ2tomakethemomentconditionsasclosetozeroaspossibleforagivenW.
ForamoregeneralGMMestimator,see[R]gmm.
gmmdoesnotrestrictyoutottingasinglelinearequation,thoughthesyntaxismorecomplex.
Awell-knownresultisthatifwedenethematrixS0tobethecovarianceofziuiandsetW=S10,thenweobtaintheoptimaltwo-stepGMMestimator,wherebyoptimalestimatorwemeantheonethatresultsinthesmallestvariancegiventhemomentconditionsdenedin(3).
Supposethattheerrorsuiareheteroskedasticbutindependentamongobservations.
ThenS0=E(ziuiuizi)=E(u2izizi)andthesampleanalogueisS=1Niu2izizi(6)Toimplementthisestimator,weneedestimatesofthesampleresidualsui.
ivregressgmmobtainstheresidualsbyestimatingβ1andβ2by2SLSandthenevaluates(6)andsetsW=S1.
Equation(6)isthesameasthecentertermofthe"sandwich"robustcovariancematrixavailablefrommostStataestimationcommandsthroughthevce(robust)option.
ivregress—Single-equationinstrumental-variablesregression9Example3:GMMestimatorHereweretourmodelofrentsbyusingtheGMMestimator,allowingforheteroskedasticityinui:.
ivregressgmmrentpcturban(hsngval=faminci.
region),wmatrix(robust)Instrumentalvariables(GMM)regressionNumberofobs=50Waldchi2(2)=112.
09Prob>chi2=0.
0000R-squared=0.
6616GMMweightmatrix:RobustRootMSE=20.
358RobustrentCoef.
Std.
Err.
zP>|z|[95%Conf.
Interval]hsngval.
0014643.
00044733.
270.
001.
0005877.
002341pcturban.
7615482.
28951052.
630.
009.
19411811.
328978_cons112.
122710.
8023410.
380.
00090.
95052133.
2949Instrumented:hsngvalInstruments:pcturbanfaminc2.
region3.
region4.
regionBecausewerequestedthataheteroskedasticity-consistentweightingmatrixbeusedduringestimationbutdidnotspecifythevce()option,ivregressreportedstandarderrorsthatarerobusttoheteroskedasticity.
Hadwespeciedvce(unadjusted),wewouldhaveobtainedstandarderrorsthatwouldbecorrectonlyiftheweightingmatrixWdoesinfactconvergetoS10.
TechnicalnoteManysoftwarepackagesthatimplementGMMestimationusethesameheteroskedasticity-consistentweightingmatrixweusedinthepreviousexampletoobtaintheoptimaltwo-stepestimatesbutdonotuseaheteroskedasticity-consistentVCE,eventhoughtheymaylabelthestandarderrorsasbeing"robust".
Toreplicateresultsobtainedfromotherpackages,youmayhavetousethevce(unadjusted)option.
SeeMethodsandformulasbelowforadiscussionofrobustcovariancematrixestimationintheGMMframework.
BychangingourdenitionofS0,wecanobtainGMMestimatorssuitableforusewithothertypesofdatathatviolatetheassumptionthattheerrorsareindependentandidenticallydistributed.
Forexample,youmayhaveadatasetthatconsistsofmultipleobservationsforeachpersoninasample.
Theobservationsthatcorrespondtothesamepersonarelikelytobecorrelated,andtheestimationtechniqueshouldaccountforthatlackofindependence.
Saythatinyourdataset,peopleareidentiedbythevariablepersonidandyoutype.
ivregressgmm.
.
.
,wmatrix(clusterpersonid)HereivregressestimatesS0asS=1Nc∈CqcqcwhereCdenotesthesetofclustersandqc=i∈cjuizi10ivregress—Single-equationinstrumental-variablesregressionwherecjdenotesthejthcluster.
Thisweightingmatrixaccountsforthewithin-personcorrelationamongobservations,sotheGMMestimatorthatusesthisversionofS0willbemoreefcientthantheestimatorthatignoresthiscorrelation.
Example4:GMMestimatorwithclusteringWehavedatafromtheNationalLongitudinalSurveyonyoungwomen'swagesasreportedinaseriesofinterviewsfrom1968through1988,andwewanttotamodelofwagesasafunctionofeachwoman'sageandagesquared,jobtenure,birthyear,andlevelofeducation.
Webelievethatrandomshocksthataffectawoman'swagealsoaffectherjobtenure,sowetreattenureasendogenous.
Asadditionalinstruments,weuseherunionstatus,numberofweeksworkedinthepastyear,andadummyindicatingwhethershelivesinametropolitanarea.
Becausewehaveseveralobservationsforeachwoman(correspondingtointerviewsdoneoverseveralyears),wewanttocontrolforclusteringoneachperson.
.
usehttps://www.
stata-press.
com/data/r16/nlswork(NationalLongitudinalSurvey.
YoungWomen14-26yearsofagein1968).
ivregressgmmln_wageagec.
age#c.
agebirth_yrgrade>(tenure=unionwks_workmsp),wmatrix(clusteridcode)Instrumentalvariables(GMM)regressionNumberofobs=18,625Waldchi2(5)=1807.
17Prob>chi2=0.
0000R-squared=.
GMMweightmatrix:Cluster(idcode)RootMSE=.
46951(Std.
Err.
adjustedfor4,110clustersinidcode)Robustln_wageCoef.
Std.
Err.
zP>|z|[95%Conf.
Interval]tenure.
099221.
003776426.
270.
000.
0918194.
1066227age.
0171146.
00668952.
560.
011.
0040034.
0302259c.
age#c.
age-.
0005191.
000111-4.
680.
000-.
0007366-.
0003016birth_yr-.
0085994.
0021932-3.
920.
000-.
012898-.
0043008grade.
071574.
002993823.
910.
000.
0657062.
0774417_cons.
8575071.
16162745.
310.
000.
54072311.
174291Instrumented:tenureInstruments:agec.
age#c.
agebirth_yrgradeunionwks_workmspBothjobtenureandyearsofschoolinghavesignicantpositiveeffectsonwages.
Time-seriesdataareoftenplaguedbyserialcorrelation.
Inthesecases,wecanconstructaweightingmatrixtoaccountforthefactthattheerrorinperiodtisprobablycorrelatedwiththeerrorsinperiodst1,t2,etc.
AnHACweightingmatrixcanbeusedtoaccountforbothserialcorrelationandpotentialheteroskedasticity.
TorequestanHACweightingmatrix,youspecifythewmatrix(hackernel#|opt)option.
kernelspecieswhichofthreekernelstouse:bartlett,parzen,orquadraticspectral.
kerneldeterminestheamountofweightgiventolaggedvalueswhencomputingtheHACmatrix,and#denotesthemaximumnumberoflagstouse.
Manytextsrefertothebandwidthofthekernelinsteadofthenumberoflags;thebandwidthisequaltothenumberoflagsplusone.
Ifneitheroptnor#isspecied,thenN2lagsareused,whereNisthesamplesize.
ivregress—Single-equationinstrumental-variablesregression11Ifyouspecifywmatrix(hackernelopt),thenivregressusesNeweyandWest's(1994)algorithmforautomaticallyselectingthenumberoflagstouse.
Althoughtheauthors'MonteCarlosimulationsdoshowthattheproceduremayresultinsizedistortionsofhypothesistests,theprocedureisstillusefulwhenlittleotherinformationisavailabletohelpchoosethenumberoflags.
FormoreonGMMestimation,seeBaum(2006);Baum,Schaffer,andStillman(2003,2007);CameronandTrivedi(2005);DavidsonandMacKinnon(1993);Hayashi(2000);orWooldridge(2010).
SeeNeweyandWest(1987)andWangandWu(2012)foranintroductiontoHACcovariancematrixestimation.
VideoexampleInstrumentalvariablesregressionusingStataStoredresultsivregressstoresthefollowingine():Scalarse(N)numberofobservationse(mss)modelsumofsquarese(dfm)modeldegreesoffreedome(rss)residualsumofsquarese(dfr)residualdegreesoffreedome(r2)R2e(r2a)adjustedR2e(F)Fstatistice(rmse)rootmeansquarederrore(Nclust)numberofclusterse(chi2)χ2e(kappa)κusedinLIMLestimatore(J)valueofGMMobjectivefunctione(wlagopt)lagsusedinHACweightmatrix(ifNewey–Westalgorithmused)e(vcelagopt)lagsusedinHACVCEmatrix(ifNewey–Westalgorithmused)e(haclag)HAClage(rank)rankofe(V)e(iterations)numberofGMMiterations(0ifnotapplicable)Macrose(cmd)ivregresse(cmdline)commandastypede(depvar)nameofdependentvariablee(instd)instrumentedvariablee(insts)instrumentse(constant)noconstantorhasconstantifspeciede(wtype)weighttypee(wexp)weightexpressione(title)titleinestimationoutpute(clustvar)nameofclustervariablee(hackernel)HACkernele(vce)vcetypespeciedinvce()e(vcetype)titleusedtolabelStd.
Err.
e(estimator)2sls,liml,orgmme(exogr)exogenousregressorse(wmatrix)wmtypespeciedinwmatrix()e(moments)centeredifcenterspeciede(small)smallifsmall-samplestatisticse(properties)bVe(estatcmd)programusedtoimplementestat12ivregress—Single-equationinstrumental-variablesregressione(predict)programusedtoimplementpredicte(footnote)programusedtoimplementfootnotedisplaye(marginsok)predictionsallowedbymarginse(marginsnotok)predictionsdisallowedbymarginse(asbalanced)factorvariablesfvsetasasbalancede(asobserved)factorvariablesfvsetasasobservedMatricese(b)coefcientvectore(W)weightmatrixusedtocomputeGMMestimatese(S)momentcovariancematrixusedtocomputeGMMvariance–covariancematrixe(V)variance–covariancematrixoftheestimatorse(Vmodelbased)model-basedvarianceFunctionse(sample)marksestimationsampleInadditiontotheabove,thefollowingisstoredinr():Matricesr(table)matrixcontainingthecoefcientswiththeirstandarderrors,teststatistics,p-values,andcondenceintervalsNotethatresultsstoredinr()areupdatedwhenthecommandisreplayedandwillbereplacedwhenanyr-classcommandisrunaftertheestimationcommand.
MethodsandformulasMethodsandformulasarepresentedunderthefollowingheadings:Notation2SLSandLIMLestimatorsGMMestimatorNotationItemsprintedinlowercaseanditalicized(forexample,x)arescalars.
Itemsprintedinlowercaseandboldfaced(forexample,x)arevectors.
Itemsprintedinuppercaseandboldfaced(forexample,X)arematrices.
Themodelisy=Yβ1+X1β2+u=Xβ+uY=X1Π1+X2Π2+v=ZΠ+VwhereyisanN*1vectoroftheleft-hand-sidevariable;Nisthesamplesize;YisanN*pmatrixofpendogenousregressors;X1isanN*k1matrixofk1includedexogenousregressors;X2isanN*k2matrixofk2excludedexogenousvariables,X=[YX1],Z=[X1X2];uisanN*1vectoroferrors;VisanN*pmatrixoferrors;β=[β1β2]isak=(p+k1)*1vectorofparameters;andΠisa(k1+k2)*pvectorofparameters.
Ifaconstanttermisincludedinthemodel,thenonecolumnofX1containsallones.
Letvbeacolumnvectorofweightsspeciedbytheuser.
Ifnoweightsarespecied,v=1.
Letwbeacolumnvectorofnormalizedweights.
Ifnoweightsarespeciedoriftheuserspeciedfweightsoriweights,w=v;otherwise,w=v/(1v)(11).
LetDdenotetheN*Nmatrixwithwonthemaindiagonalandzeroselsewhere.
Ifnoweightsarespecied,Distheidentitymatrix.
ivregress—Single-equationinstrumental-variablesregression13Theweightednumberofobservationsnisdenedas1w.
Foriweights,thisistruncatedtoaninteger.
Thesumoftheweightsis1v.
Denec=1ifthereisaconstantintheregressionandzerootherwise.
Theorderconditionforidenticationrequiresthatk2≥p:thenumberofexcludedexogenousvariablesmustbeatleastasgreatasthenumberofendogenousregressors.
Inthefollowingformulas,ifweightsarespecied,X1X1,XX,Xy,yy,ZZ,ZX,andZyarereplacedwithX1DX1,XDX,XDy,yDy,ZDZ,ZDX,andZDy,respectively.
WesuppresstheDbelowtosimplifythenotation.
2SLSandLIMLestimatorsDenetheκ-classestimatorofβasb=X(IκMZ)X1X(IκMZ)ywhereMZ=IZ(ZZ)1Z.
The2SLSestimatorresultsfromsettingκ=1.
TheLIMLestimatorresultsfromselectingκtobetheminimumeigenvalueof(YMZY)1/2YMX1Y(YMZY)1/2,whereMX1=IX1(X1X1)1X1.
Thetotalsumofsquares(TSS)equalsyyifthereisnointerceptandyy(1y)2/notherwise.
Thedegreesoffreedomisnc.
Theerrorsumofsquares(ESS)isdenedasyy2bXy+bXXb.
Themodelsumofsquares(MSS)equalsTSSESS.
Thedegreesoffreedomiskc.
Themeansquarederror,s2,isdenedasESS/(nk)ifsmallisspeciedandESS/notherwise.
Therootmeansquarederroriss,itssquareroot.
Ifc=1andsmallisnotspecied,aWaldstatistic,W,ofthejointsignicanceofthek1parametersofβexcepttheconstanttermiscalculated;Wχ2(k1).
Ifc=1andsmallisspecied,thenanFstatisticiscalculatedasF=W/(k1);FF(k1,nk).
TheR2isdenedasR2=1ESS/TSS.
TheadjustedR2isR2a=1(1R2)(nc)/(nk).
Theunadjusted(default)varianceestimateisVar(b)=s2X(IκMZ)X1.
Forageneraldiscussionofrobustvarianceestimatesinregression,seeAgeneralnotationfortherobustvariancecalculationin[R]regress.
ivregressusesthesamedenitionsfortermsdiscussedinRobustcalculationforregressinitsrobustvariancecalculation,exceptforthefollowing.
Thevectorofscoresisgivenbyuj=(yjxjb)xjwherexj=PzjandP=(XZ)(ZZ)1.
Whentheformulasin[R]regressareapplied,qcisgivenbyitsregressionlikedenition.
Ifsmallisnotspecied,thenk=0intheformulasgivenin[R]regress.
ivregress2slsandivregresslimlalsosupportestimationwithsurveydata.
FordetailsonVCEswithsurveydata,see[SVY]Varianceestimation.
14ivregress—Single-equationinstrumental-variablesregressionGMMestimatorWeobtainaninitialconsistentestimateofβbyusingthe2SLSestimator;seeabove.
Usingthisestimateofβ,wecomputetheweightingmatrixWandcalculatetheGMMestimatorbGMM=XZWZX1XZWZyThevarianceofbGMMisVar(bGMM)=nXZWZX1XZWSWZXXZWZX1Var(bGMM)isofthesandwichformDMD;see[P]robust.
Iftheuserspeciesthesmalloption,ivregressimplementsasmall-sampleadjustmentbymultiplyingtheVCEbyN/(Nk).
Ifvce(unadjusted)isspecied,thenwesetS=W1andtheVCEreducestothe"optimal"GMMvarianceestimatorVar(βGMM)=nXZWZX1However,ifW1isnotagoodestimatorofE(ziuiuizi),thentheoptimalGMMestimatorisinefcient,andinferencebasedontheoptimalvarianceestimatorcouldbemisleading.
Wiscalculatedusingtheresidualsfromtheinitial2SLSestimates,whereasSisestimatedusingtheresidualsbasedonbGMM.
Thewmatrix()optionaffectstheformofW,whereasthevce()optionaffectstheformofS.
Exceptfordifferentresidualsbeingused,theformulasforW1andSareidentical,sowefocusonestimatingW1.
Ifwmatrix(unadjusted)isspecied,thenW1=s2niziziwheres2=iu2i/n.
Thisweightmatrixisappropriateiftheerrorsarehomoskedastic.
Ifwmatrix(robust)isspecied,thenW1=1niu2iziziwhichisappropriateiftheerrorsareheteroskedastic.
Ifwmatrix(clusterclustvar)isspecied,thenW1=1ncqcqcwherecindexesclusters,qc=i∈cjuiziandcjdenotesthejthcluster.
Ifwmatrix(hackernel#)isspecied,thenW1=1niu2izizi+1nl=n1l=1i=ni=l+1K(l,m)uiuilzizil+zilziivregress—Single-equationinstrumental-variablesregression15wherem=#if#isspeciedandm=n2otherwise.
Denez=l/(m+1).
Ifkernelisnwest,thenK(l,m)=1z0≤z≤10otherwiseIfkernelisgallant,thenK(l,m)=16z2+6z30≤z≤0.
52(1z)30.
5Ifwmatrix(hackernelopt)isspecied,thenivregressusesNeweyandWest's(1994)automaticlag-selectionalgorithm,whichproceedsasfollows.
Denehtobea(k1+k2)*1vectorcontainingonesinallrowsexceptfortherowcorrespondingtotheconstantterm(ifpresent);thatrowcontainsazero.
Denefi=(uizi)hσj=1nni=j+1fifijj=0,ms(q)=2mj=1σjjqs(0)=σ0+2mj=1σjγ=cγs(q)s(0)21/2q+1m=γn1/(2q+1)whereq,m,andcγdependonthekernelspecied:KernelqmcγBartlett1int20(T/100)2/91.
1447Parzen2int20(T/100)4/252.
6614Quadraticspectral2int20(T/100)2/251.
3221whereint(x)denotestheintegerobtainedbytruncatingxtowardzero.
FortheBartlettandParzenkernels,theoptimallagismin{int(m),m}.
Forthequadraticspectral,theoptimallagismin{m,m}.
Ifwmatrix(hackernelopt#)isspecied,thenivregressuses#insteadof20inthedenitionofmabovetoselecttheoptimallag.
Ifcenterisspecied,whencomputingweightingmatricesivregressreplacesthetermuiziintheformulasabovewithuiziuz,whereuz=iuizi/N.
16ivregress—Single-equationinstrumental-variablesregressionReferencesAnatolyev,S.
,andA.
Skolkova.
2019.
Manyinstruments:ImplementationinStata.
StataJournal19:849–866.
Andrews,D.
W.
K.
1991.
Heteroskedasticityandautocorrelationconsistentcovariancematrixestimation.
Econometrica59:817–858.
Angrist,J.
D.
,andJ.
-S.
Pischke.
2009.
MostlyHarmlessEconometrics:AnEmpiricist'sCompanion.
Princeton,NJ:PrincetonUniversityPress.
Basmann,R.
L.
1957.
Ageneralizedclassicalmethodoflinearestimationofcoefcientsinastructuralequation.
Econometrica25:77–83.
Bauldry,S.
2014.
miivnd:Acommandforidentifyingmodel-impliedinstrumentalvariablesforstructuralequationmodelsinStata.
StataJournal14:60–75.
Baum,C.
F.
2006.
AnIntroductiontoModernEconometricsUsingStata.
CollegeStation,TX:StataPress.
Baum,C.
F.
,andA.
Lewbel.
2019.
Adviceonusingheteroskedasticity-basedidentication.
StataJournal19:757–767.
Baum,C.
F.
,M.
E.
Schaffer,andS.
Stillman.
2003.
InstrumentalvariablesandGMM:Estimationandtesting.
StataJournal3:1–31.
.
2007.
Enhancedroutinesforinstrumentalvariables/generalizedmethodofmomentsestimationandtesting.
StataJournal7:465–506.
Cameron,A.
C.
,andP.
K.
Trivedi.
2005.
Microeconometrics:MethodsandApplications.
NewYork:CambridgeUniversityPress.
.
2010.
MicroeconometricsUsingStata.
Rev.
ed.
CollegeStation,TX:StataPress.
Choi,J.
,andS.
Shen.
2019.
Two-sampleinstrumental-variablesregressionwithpotentiallyweakinstruments.
StataJournal19:581–597.
Clarke,D.
,andB.
Matta.
2018.
PracticalconsiderationsforquestionableIVs.
StataJournal18:663–691.
Davidson,R.
,andJ.
G.
MacKinnon.
1993.
EstimationandInferenceinEconometrics.
NewYork:OxfordUniversityPress.
Deb,P.
,E.
C.
Norton,andW.
G.
Manning.
2017.
HealthEconometricsUsingStata.
CollegeStation,TX:StataPress.
Desbordes,R.
,andV.
Verardi.
2012.
Arobustinstrumental-variablesestimator.
StataJournal12:169–181.
D'Haultfuille,X.
,A.
Maurel,X.
Qiu,andY.
Zhang.
2020.
EstimatingselectionmodelswithoutaninstrumentwithStata.
StataJournal20:297–308.
Dippel,C.
,A.
Ferrara,andS.
Heblich.
2020.
Causalmediationanalysisininstrumental-variablesregressions.
StataJournal20:613–626.
Finlay,K.
,andL.
M.
Magnusson.
2009.
Implementingweak-instrumentrobusttestsforageneralclassofinstrumental-variablesmodels.
StataJournal9:398–421.
Gallant,A.
R.
1987.
NonlinearStatisticalModels.
NewYork:Wiley.
Greene,W.
H.
2018.
EconometricAnalysis.
8thed.
NewYork:Pearson.
Hall,A.
R.
2005.
GeneralizedMethodofMoments.
Oxford:OxfordUniversityPress.
Hansen,L.
P.
1982.
Largesamplepropertiesofgeneralizedmethodofmomentsestimators.
Econometrica50:1029–1054.
Hayashi,F.
2000.
Econometrics.
Princeton,NJ:PrincetonUniversityPress.
Judge,G.
G.
,W.
E.
Grifths,R.
C.
Hill,H.
L¨utkepohl,andT.
-C.
Lee.
1985.
TheTheoryandPracticeofEconometrics.
2nded.
NewYork:Wiley.
Kmenta,J.
1997.
ElementsofEconometrics.
2nded.
AnnArbor:UniversityofMichiganPress.
Koopmans,T.
C.
,andW.
C.
Hood.
1953.
StudiesinEconometricMethod.
NewYork:Wiley.
Koopmans,T.
C.
,andJ.
Marschak.
1950.
StatisticalInferenceinDynamicEconomicModels.
NewYork:Wiley.
Newey,W.
K.
,andK.
D.
West.
1987.
Asimple,positivesemi-denite,heteroskedasticityandautocorrelationconsistentcovariancematrix.
Econometrica55:703–708.
.
1994.
Automaticlagselectionincovariancematrixestimation.
ReviewofEconomicStudies61:631–653.
Nichols,A.
2007.
Causalinferencewithobservationaldata.
StataJournal7:507–541.
ivregress—Single-equationinstrumental-variablesregression17Palmer,T.
M.
,V.
Didelez,R.
R.
Ramsahai,andN.
A.
Sheehan.
2011.
Nonparametricboundsforthecausaleffectinabinaryinstrumental-variablemodel.
StataJournal11:345–367.
Pinzon,E.
2016.
Estimationunderomittedconfounders,endogeneity,omittedvariablebias,andrelatedproblems.
TheStataBlog:NotElsewhereClassied.
http://blog.
stata.
com/2017/02/20/estimation-under-omitted-confounders-endogeneity-omitted-variable-bias-and-related-problems/.
Poi,B.
P.
2006.
JackknifeinstrumentalvariablesestimationinStata.
StataJournal6:364–376.
Stock,J.
H.
,andM.
W.
Watson.
2019.
IntroductiontoEconometrics.
4thed.
NewYork:Pearson.
Stock,J.
H.
,J.
H.
Wright,andM.
Yogo.
2002.
Asurveyofweakinstrumentsandweakidenticationingeneralizedmethodofmoments.
JournalofBusiness&EconomicStatistics20:518–529.
Sun,L.
2018.
Implementingvalidtwo-stepidentication-robustcondencesetsforlinearinstrumental-variablesmodels.
StataJournal18:803–825.
Theil,H.
1953.
RepeatedLeastSquaresAppliedtoCompleteEquationSystems.
MimeographfromtheCentralPlanningBureau,TheHague.
Wang,Q.
,andN.
Wu.
2012.
Long-runcovarianceanditsapplicationsincointegrationregression.
StataJournal12:515–542.
Wooldridge,J.
M.
2010.
EconometricAnalysisofCrossSectionandPanelData.
2nded.
Cambridge,MA:MITPress.
.
2020.
IntroductoryEconometrics:AModernApproach.
7thed.
Boston:Cengage.
Wright,P.
G.
1928.
TheTariffonAnimalandVegetableOils.
NewYork:Macmillan.
Alsosee[R]ivregresspostestimation—Postestimationtoolsforivregress[R]gmm—Generalizedmethodofmomentsestimation[R]ivprobit—Probitmodelwithcontinuousendogenouscovariates[R]ivtobit—Tobitmodelwithcontinuousendogenouscovariates[R]reg3—Three-stageestimationforsystemsofsimultaneousequations[R]regress—Linearregression[ERM]eregress—Extendedlinearregression[FMM]fmm:ivregress—Finitemixturesoflinearregressionmodelswithendogenouscovariates[SEM]Intro5—Tourofmodels[SP]spivregress—Spatialautoregressivemodelswithendogenouscovariates[SVY]svyestimation—Estimationcommandsforsurveydata[TS]forecast—Econometricmodelforecasting[XT]xtivreg—Instrumentalvariablesandtwo-stageleastsquaresforpanel-datamodels[U]20Estimationandpostestimationcommands
近日华纳云发布了最新的618返场优惠活动,主要针对旗下的免备案香港云服务器、香港独立服务器、香港高防御服务器等产品,月付6折优惠起,高防御服务器可提供20G DDOS防御,采用E5处理器V4CPU性能,10Mbps独享CN2 GIA高速优质带宽,有需要免备案香港服务器、香港云服务器、香港独立服务器、香港高防御服务器、香港物理服务器的朋友可以尝试一下。华纳云好不好?华纳云怎么样?华纳云服务器怎么样?...
cmivps香港VPS带来了3个新消息:(1)双向流量改为单向流量,相当于流量间接扩大一倍;(2)Hong Kong 2T、Hong Kong 3T、Hong Kong 无限流量,这三款VPS开始支持Windows系统,如果需要中文版Windows系统请下单付款完成之后发ticket要求官方更改即可;(3)全场7折年付、8折月付优惠,优惠码有效期一个月!官方网站:https://www.cmivp...
Justg是一家俄罗斯VPS云服务器提供商,主要提供南非地区的VPS服务器产品,CN2高质量线路网络,100Mbps带宽,自带一个IPv4和8个IPv6,线路质量还不错,主要是用户较少,带宽使用率不高,比较空闲,不拥挤,比较适合面向非洲、欧美的用户业务需求,也适合追求速度快又需要冷门的朋友。justg的俄罗斯VPS云服务器位于莫斯科机房,到美国和中国速度都非常不错,到欧洲的平均延迟时间为40毫秒,...
22zizi.com为你推荐
haole018.comhttp://www.haoledy.com/view/32092.html 轩辕剑天之痕11、12集在线观看郭泊雄郭佰雄最后一次出现是什么时候?336.com求那个网站 你懂得 1552517773@qq抓站工具一起来捉妖神行抓妖辅助工具都有哪些?www.se222se.com请问http://www.dibao222.com这个网是做什么www.99vv1.comwww.in9.com是什么网站啊?www.147.qqq.com谁有147清晰的视频?学习学习本冈一郎只想问本冈一郎的效果真的和说的一样吗?大概多长时间可以管用呢?用过的进!干支论坛天干地支红玉头冠古剑奇谭红玉的外装都有什么,不是衣服,是外装
com域名 俄罗斯vps 什么是域名地址 赵容 美国主机评论 国外php主机 10t等于多少g 商家促销 日本空间 台湾谷歌网址 卡巴斯基官方免费版 国外免费全能空间 美国免费空间 免费dns解析 电信主机 web服务器安全 安徽双线服务器 最漂亮的qq空间 带宽租赁 网站加速软件 更多