【正文】
39。39。39。 y?? is approximately equal to which is smaller in absolute value than our tolerance of so we can stop. The Newton Raphson algorithm here returns a value of pi equal to which is reasonably close to the analytical value of . Note we can make the Newton Raphson procedure more accurate (within machine precision) by setting the tolerance level closer to 0 . 3 The Newton Raphson Algorithm for Finding the Maximum of a Function of k Variables Taylor Series Approximations in k Dimensions Consider a function RRf k ?: that is at least twice continuously differentiable. Suppose kRx? and kRh? . Then the first order Taylor approximation to f at x is given by hxfxfhxf 39。39。 ??y?? which is still larger in absolute value than our tolerance of . Thus we set .)()( 1 139。39。 ??y?? which is larger in absolute value than our tolerance of . Thus we set )()( 1 039。39。1 iiii xfxfxxii ixx?? return )(?x Caution: Note that the Newton Raphson Algorithm doesn’t check the second order conditions necessary for ?x to be a maximizer. This means that if you give the algorithm a bad starting value for 0x you may end up with a min rather than a max. Example: Calculating the MLE of a Binomial Sampling Model To see how the Newton Raphson algorithm works in practice lets look at a simple example with an analytical solution– a simple model of binomial sampling. Our loglikelihood function is: )1l n ()()l n ()( ??? ???? ynyy? where n is the sample size, y is the number of successes, and ? is the probability of a first derivative of the loglikelihood function is ??? ????? 1 1)()(39。139。 xfxfx?? With this in mind we can specify the Newton Raphson algorithm for 1 dimensional function optimization. Algorithm : NewtonRaphson1D( f , 0x ,tolerance) ment: Find the value ?x of x that maximizes )(xf 0?i While tolerancexf i ?)(39。39。 xfc? . This implies chbhxf ??? )(39。 xfb? , and )(39。39。 ?? We know that 0)(39。39。 xfb? . This highlights the fact that the first order Taylor approximation is a linear function in h . Similarly, the second order Taylor approximation can be rewritten as: 221)( chbhahxf ???? Where )(xfa? , )(39。39。??? This is referred to as a first order Taylor approximation of f at x . A more accurate approximation to )( hxf ? can be constructed for small values of h as: 239。39。 譯文: 摘自: The Newton Raphson Algorithm for FunctionOptimization Kevin Quinn Assist