[R] roots of a function

Alejandro Veen veen at stat.ucla.edu
Mon Nov 14 19:23:02 CET 2005


For finding the root of the following function I have been using 'uniroot':

f(p) = log(p-1) - log(p) + 1/(p-1) - log(A) - B = 0

where 'p' is a scalar.  However, I will have to find this root repeatedly,
so I would like to suggest a starting value, which is not possible with
'uniroot'.  'nlm' allows the use of starting values, so I have been thinking
of applying 'nlm' to abs(f(p)).  Is that the way to go or is there a better
way I don't know about?

Thanks for your help,

Alejandro




More information about the R-help mailing list