Transcription of newey — Regression with Newey–West standard errors
1 Regression with newey West standard errorsSyntaxMenuDescriptionOptionsRemark s and examplesStored resultsMethods and formulasReferencesAlso seeSyntaxneweydepvar[indepvars] [if] [in] [weight], lag(#)[options]optionsDescriptionModel lag(#)set maximum lag order of autocorrelationnoconstantsuppress constant termReportinglevel(#)set confidence level; default islevel(95)displayoptionscontrol column formats, row spacing, line width, display of omittedvariables and base and empty cells, and factor-variable labelingcoeflegenddisplay legend instead of statistics lag(#)is musttssetyour data before usingnewey; see [TS] contain factor variables; see[U] Factor contain time-series operators; see[U] Time-series ,rolling, andstatsbyare allowed; see[U] Prefix are allowed.
2 See[U] not appear in the dialog [U] 20 Estimation and postestimation commandsfor more capabilities of estimation >Time series> Regression with newey -West std. errorsDescriptionneweyproduces newey West standard errors for coefficients estimated byOLSregression. Theerror structure is assumed to be heteroskedastic and possibly autocorrelated up to some Model lag(#)specifies the maximum lag to be considered in the autocorrelation structure. If you specifylag(0), the output is the same asregress, vce(robust).lag()is ; see [R]estimation newey Regression with newey West standard errors Reporting level(#); see [R]estimation :noomitted,vsquish,noemptycells,baseleve ls,allbaselevels,nofvla-bel,fvwrap(#),fv wrapon(style),cformat(%fmt),pformat(%fmt ),sformat(%fmt), andnolstretch; see [R]estimation following option is available withneweybut is not shown in the dialog box:coeflegend.
3 See [R]estimation and Huber/White/sandwich robust variance estimator (see White [1980]) produces consistentstandard errors forOLSregression coefficient estimates in the presence of heteroskedasticity. TheNewey West (1987) variance estimator is an extension that produces consistent estimates when thereis autocorrelation in addition to possible newey West variance estimator handles autocorrelation up to and including a lag ofm,wheremis specified by stipulating thelag()option. Thus, it assumes that any autocorrelation atlags greater thanmcan be (0)is specified, the variance estimates produced byneweyare simply the Hu-ber/White/sandwich robust variances estimates calculated byregress, vce(robust); see [R] 1newey, lag(0)is equivalent toregress, vce(robust).
4 Use (1978 Automobile Data). regress price weight displ, vce(robust)Linear Regression Number of obs = 74F( 2, 71) = > F = = MSE = Std. Err. t P>|t| [95% Conf. Interval] .7808755 .2663445 generate t = _n. tsset ttime variable: t, 1 to 74delta: 1 unitnewey Regression with newey West standard errors 3. newey price weight displ, lag(0) Regression with newey -West standard errors Number of obs = 74maximum lag: 0 F( 2, 71) = > F = Std.
5 Err. t P>|t| [95% Conf. Interval] .7808755 .2663445 the dataset to betsset, we generated a dummy time variablet, which inthis example played no role in the 2 Say that we have time-series measurements on variablesusrandidleand now wish to fit anOLSmodel but obtain newey West standard errors allowing for a lag of up to 3:. use , clear. tsset timetime variable: time, 1 to 30delta: 1 unit. newey usr idle, lag(3) Regression with newey -West standard errors Number of obs = 30maximum lag: 3 F( 1, 28) = > F = Std.
6 Err. t P>|t| [95% Conf. Interval] .0690927 newey Regression with newey West standard errorsStored resultsneweystores the following ine():Scalarse(N)number of observationse(dfm)model degrees of freedome(dfr)residual degrees of freedome(F)Fstatistice(lag)maximum lage(rank)rank ofe(V)Macrose(cmd) neweye(cmdline)command as typede(depvar)name of dependent variablee(wtype)weight typee(wexp)weight expressione(title)title in estimation outpute(vcetype)title used to label Std. (properties) b Ve(estatcmd)program used to implementestate(predict)program used to implementpredicte(asbalanced)factor variablesfvsetasasbalancede(asobserved)f actor variablesfvsetasasobservedMatricese(b)co efficient vectore(Cns)constraints matrixe(V)variance covariance matrix of the estimatorsFunctionse(sample)marks estimation sampleMethods and formulasneweycalculates the estimates OLS= (X X) 1X y Var( OLS) = (X X) 1X X(X X) 1 That is, the coefficient estimates are simply those ofOLSlinear (0)(no autocorrelation)
7 , the variance estimates are calculated using the White formulation:X X=X 0X=nn k i e2ix ixiHere ei=yi xi OLS, wherexiis theith row of theXmatrix,nis the number of observations,andkis the number of predictors in the model, including the constant if there is one. The aboveformula is the same as that used byregress, vce(robust)with the Regression -like formula (thedefault) for the multiplierqc; seeMethods and formulasof [R] Regression with newey West standard errors 5 Forlag(m),m >0, the variance estimates are calculated using the newey West (1987)formulationX X=X 0X+nn km l=1(1 lm+ 1)n t=l+1 et et l(x txt l+x t lxt)wherextis the row of theXmatrix observed at timet.
8 Whitney K. newey (1954 ) earned degrees in economics at Brigham Young University andMIT. After a period at Princeton, he returned toMITas a professor in 1990. His interests intheoretical and applied econometrics include bootstrapping, nonparametric estimation of models,semiparametric models, and choosing the number of instrumental D. West (1953 ) earned a bachelor s degree in economics and mathematics at WesleyanUniversity and then a PhD in economics atMIT. After a period at Princeton, he joined theUniversity of Wisconsin in 1988. His interests include empirical macroeconomics and time-series econometrics.
9 ReferencesHardin, J. W. 1997. sg72: newey West standard errors for probit, logit, and poisson Technical Bulletin39: 32 35. Reprinted inStata Technical Bulletin Reprints, vol. 7, pp. 182 186. College Station, TX: Stata , W. K., and K. D. West. 1987. A simple, positive semi-definite, heteroskedasticity and autocorrelation consistentcovariance : 703 , Q., and N. Wu. 2012. Long-run covariance and its applications in cointegration Journal12:515 , H. L., Jr. 1980. A heteroskedasticity-consistent covariance matrix estimator and a direct test for : 817 see[TS] newey postestimation Postestimation tools for newey [TS]arima ARIMA, ARMAX, and other dynamic Regression models[TS]forecast Econometric model forecasting[TS]tsset Declare data to be time-series data[R]regress Linear Regression [U] 20 Estimation and postestimation commands