[R] Newton method iteration problem
Charles C. Berry
cberry at tajo.ucsd.edu
Sat Oct 27 06:12:29 CEST 2007
On Fri, 26 Oct 2007, kevinchang wrote:
> Hi all,
> I am coding for finding the root of f(x)= phi(x) -alpha where phi(x) is the
> cumulative density function and alpha is constant . The problem right now is
> I can't get the "initialX" representing the root out of the while loop when
> ending , it seems to me it disappear when the loop ends accroding to the
> error message. I need help . Please suggest the cause or solution to this
> problem. Thanks.
Learn to type without making errors? Learn to format (space and indent)
your code so errors will be more obvious to you??
Your code worked for me once I corrected the typos and syntax errors.
It even agrees with qnorm( setAlpha ).
If all you want is root finding capability, I suggest you see
> # code
> #generate target function (phi(x)-alpha) (allow input x and alpha)
> #generate the first derivative of the of the target function
> # Finding the root by Newton method
> View this message in context: http://www.nabble.com/Newton-method-iteration-problem-tf4701085.html#a13439031
> Sent from the R help mailing list archive at Nabble.com.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
Charles C. Berry (858) 534-2098
Dept of Family/Preventive Medicine
E mailto:cberry at tajo.ucsd.edu UC San Diego
http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901
More information about the R-help