[R] 'gmm' package: How to pass controls to a numerical solver used in the gmm() function?
dwinsemius at comcast.net
Wed Feb 20 04:01:35 CET 2013
On Feb 19, 2013, at 5:25 PM, Malikov, Emir wrote:
> Hello --
> The question I have is about the gmm() function from the 'gmm' package
> (v. 1.4-5).
> The manual accompanying the package says that the gmm() function is
> programmed to use either of four numerical solvers -- optim, optimize,
> constrOptim, or nlminb -- for the minimization of the GMM objective
> I wonder whether there is a way to pass controls to a solver used
> while calling the gmm() function?
> In particular, the problem that I have been having is that the gmm()
> fails to converge withing the default number of iteration for the
> 'optim' solver that it uses. Ideally, I would wish to figure out a way
> to be able to choose controls, including the number of iterations, for
> the solver that I tell gmm() to use.
> Currently, the way I call the function is as follows:
> model.name <- gmm(g=g.fn, x=data, gradv=g.gr, t0=c(start),
> type=c("twostep"), optfct=c("optim") )
> I also would want the gmm() function to know that I want it to pass
> the following control -- maxit=1500 -- to the optim solver.
The argument name in the manual is `itermax`. I cannot tell from lookng at the code whether that would get passed to 'optim'.
> Unfortunately, the 'gmm' manual does not tell whether this is doable.
There is also a "..." argument which is stated in the help page to be passed to "optim". Looking at ?optim one sees that controls generally need to be in a list named 'control'. That this is the intent is supported by the sentence on page 11 of the gmm vignette:
"We could try dierent starting values, increase the number of iterations in the control option of
optim or use nlminb which allows to put restrictions on the parameter space."
Alameda, CA, USA
More information about the R-help