<< nls Single equation regressions nwest >>

grocer >> Single equation regressions > nlsmod

nlsmod

Estimate non-linear least squares for equations of a model

CALLING SEQUENCE

[model2,rnls]=nlsmod(model,tsmat,indeq,arg1,...,argn)

PARAMETERS

Input

* 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 interger, the # of the equation in the model

* arg1,...,argn = optional arguments

   - 'noprint' if the user does not want to print the result (defautlt: results are displayed on screen)

   - 'save=%t' if the user wants to save the estimated coefficients in the model tlist

   - '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')

Output

* model2 = the model tlist, with the estimated coefficients if the option save has been swtiched to %t

* rnls = a nls results tlist, collecting the results of the corresponding estimated equation

DESCRIPTION

Estimates by non-linear least squares an equation of a model.

EXAMPLE

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('1981q1','2005q4');
// In the small model, estimate by non-linear least squares the equation td_p6_d1
// Estimated coefficients are stored into the small model tlist and
// the whole estimation results are stored into tlist rp6_d1:
[small,rp6_d1]=nlsmod(small,small_db,'td_p6_d1','save=%t')

AUTHOR

Éric Dubois 2019

Report an issue
<< nls Single equation regressions nwest >>