[R] a question about gradient in optim

Mehmet Balcilar mbalcilar at gmail.com
Tue May 23 10:01:17 CEST 2006


Hi,

I am using optim to estimate the parameters of a smooth transition
autoregressive model.  I  wrote a function to return the  gradient  for
each observation. So, for k parameters and n observations my function
returns a (n x k) matrix. The gr argument of optim expects a (k x 1) 
vector.  Now,  what is the correct way of passing my gradient matrix to
optim?

Mehmet



More information about the R-help mailing list