[R] numerical differentiation in R? (for optim "SANN" parscale)
BORGULYA Gábor
borgulya at gyer2.sote.hu
Wed Jul 16 12:21:40 CEST 2003
Dear R users,
I am running a maximum likelihood model with optim. I chose the
simulated annealing method (method="SANN").
SANN is not performing bad, but I guess it would be much more effecive
if I could set the `parscale' parameter.
The help sais:
`parscale' A vector of scaling values for the parameters.
Optimization is performed on `par/parscale' and these should
be comparable in the sense that a unit change in any element
produces about a unit change in the scaled value.
Since I know the approximate optimal parameters of the function to
optimise I could use these values to calculate `parscale'.
If I understand the role of `parscale' well, I have to differentiate my
function numerically.
How can I perform the numerical differentiation in R? I thought about
writing a small function, but I am sure it is already written. It must
be present at least in some of the optimisation algorithms.
Anyway, I couln't find it neither in the help, nor in the non-internal,
displayable source of optim.
Could anyone tell me where to find such a function?
And if it really is what I need for `parscale'?
Thank you!
Gábor
--
Gabor BORGULYA MD MSc
Semmelweis University of Budapest, 2nd Dept of Paediatrics
Hungarian Paediatric Cancer Registry
phone: +36 - 1 - 4591500 / 2834
More information about the R-help
mailing list