Estimate Newey-West's adjusted heteroskedastic and autocorrelation consistent least squares for equations of a model
[model2,rnwest1,...,rnwestn]=nwestmod(model,tsmat,indeq,arg1,...,argn)
* model = a model tlist
* tsmat = a tsmat containing all data needed for estimating the equation (should be the tsmat associated to the model, created by function create_dbmod)
* indeq =
- a string, the name of the equation to estimate or the keyword 'all' (to estimate all equations)
- or an integer, the # of the equation in the model
* arg1,...,argn = arguments which can be:
- a time series
- a real (n x 1) vector
- a string equal to the name of a time series or a (nx1) real vector between quotes
- the string 'noprint' if the user doesn't want the to print the results of the regression
- the string 'win=n' where n is the length of the Barlett window (default = floor(5*nobs^0.25))
- the string 'dropna' if the user wants to delete NAs (this option should be used when dealing with daily and weekly TS)
- 'save=%t' if the user wants to save the estimated coefficients in the model tlist
* model2 = the model tlist, with the estimated coefficients if the option save has been swtiched to %t
* rnwest1,...,rnwestn = a variable number of nwest results tlists, each one corresponding to the results of the corresponding estimated equation
global GROCERDIR // load the model small: load(GROCERDIR+'data\small.dat') // load the database small_db: load(GROCERDIR+'data\small_db.dat') // set the bounds: bounds('1980q1','2005q4'); // In the small model, estimate by ols the equation td_p3m_d1, with T-statistics corrected for heteroskedasticity by White's method. // Save the estimated coefficients into the small model tlist // and store into tlist rp3m_d1 the whole estimation results: [small,rp3m_d1]=nwestmod(small,small_db,'td_p3m_d1',[0 0 ],0,'save=%t'); | ![]() | ![]() |