Estimate by ols with arma errors equations of a model
[model2,rolsarma]=olsarmamod(model,tsmat,indeq,AR,MA,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
* AR = a (nar x 1) or (1 x nar) string or real vector of parameters corresponding to the AR part of the error process
- if AR is a real then all parameters are estimated
- if AR is a string then all parameters with in AR with an equality (such as '=0.5') are constrained to the given value (0.5 in the example)
- if AR is a string then it can contain inequality constraints; for instance '<0.5' indicates that coeff must be lower than 0.5
- if initown is set to %F, then the user can give any value to AR; only it size matters for the estimation process
* MA = a (nmaf x 1) or (1 x nmaf) string or real vector of corresponding to the AR part of the error, with the same working as for AR
* arg1,...,argn = arguments which can be:
- the string 'noprint' if the user doesn't want to print the results of the regression
- 'dropna' if the user wants to remove the NA values from the data
- 'init=own' if the user wants the function to impose starting values for the parameters
- 'beta=xxx' to fix the starting values of the coefficients of the regression if the user has given the option 'init=own'
- 'optfunc=optim' if the user wants to use the optim optimisation function (default: optimg)
- 'opt_nelmead=crit,nitermax' with crit the value of the convergence criterion in the Nelder-Meade optimisation function and nitermax the maximum number of iterations (default = 'opt_nelmead=2*%eps,1000')
- 'opt_optim=opts' where opts are options for optim that can be entered after the starting value of the parameters (default = 'opt_optim=,''ar'',1e6,1e6'')
- 'opt_convg=val' where val is the threshold on gradient norm (default = 'opt_convg=1e-5')
* model2 = the model tlist, with the estimated coefficients if the option save has been swtiched to %t
* rolsarma = a olsarma results tlist, collecting 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('1990q1','2005q4'); // In the small model, estimate by ols with ARMA(2,1) residuals the equation td_p3m_d1, // save the estimated coefficients into the small model tlist // and store into tlist rp3m_d1 the whole estimation results: [small,rp3m_d1]=olsarmamod(small,small_db,'td_p3m_d1',[0 0 ],0,'save=%t'); | ![]() | ![]() |