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
VirMach,成立于2014年的美国IDC商家,知名的低价便宜VPS销售商,支持支付宝、微信、PayPal等方式付款购买,主打美国、欧洲暑假中心产品,拥有包括洛杉矶、西雅图、圣何塞、凤凰城在内的11个数据中心可以选择,可以自由搭配1Gbps、2Gbps、10Gbps带宽端口,有Voxility DDoS高防IP可以选择(500Gbps以上的防御能力),并且支持在控制面板付费切换机房和更换IP(带...
Hostodo近日发布了美国独立日优惠促销活动,主要推送了四款特价优惠便宜的VPS云服务器产品,基于KVM虚拟架构,NVMe阵列,1Gbps带宽,默认分配一个IPv4+/64 IPv6,采用solusvm管理,赠送收费版DirectAdmin授权,服务有效期内均有效,大致约为7折优惠,独立日活动时间不定,活动机型售罄为止,有需要的朋友可以尝试一下。Hostodo怎么样?Hostodo服务器好不好?...
搬瓦工最新优惠码优惠码:BWH3HYATVBJW,节约6.58%,全场通用!搬瓦工关闭香港 PCCW 机房通知下面提炼一下邮件的关键信息,原文在最后面。香港 CN2 GIA 机房自从 2020 年上线以来,网络性能大幅提升,所有新订单都默认部署在香港 CN2 GIA 机房;目前可以免费迁移到香港 CN2 GIA 机房,在 KiwiVM 控制面板选择 HKHK_8 机房进行迁移即可,迁移会改变 IP...
22zizi.com为你推荐
.cn域名cn域名和com域名有什么不同?哪个更好?好在哪里?敬汉卿姓名被抢注12306身份证名字被注册怎么办johncusack约翰·库萨克好看的的恐怖片全集安徽汽车网安徽汽车票查询李子柒年入1.6亿宋朝鼎盛时期 政府财政收入有将近1亿贯铜钱,那么GDP是多少呢?百花百游“百花竟放贺阳春 万物从今尽转新 末数莫言穷运至 不知否极泰来临”是什么意思啊?www.yahoo.com.hk香港的常用网站www.qq530.com谁能给我一个听歌的网站?ip在线查询通过对方的IP地址怎么样找到他的详细地址?mole.61.com摩尔大陆?????
双线主机租用 免费申请网站域名 域名备案批量查询 域名解析文件 网易域名邮箱 外国服务器 圣迭戈 天猫双十一抢红包 中国特价网 秒杀预告 1g内存 paypal注册教程 双线机房 申请网站 沈阳主机托管 lamp兄弟连 xuni 中国联通宽带测试 买空间网 magento主机 更多