- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Calculating roots of a function
Hi everyone,
How do I calculate the roots of a function in JSL for confidence intervals?
I have a special case, where I need to calculate confidence Intervals which aren't implemented in JMP.
Using the Wilks theorem, I want to calculate confidence intervalls by calculating the roots of the following function:
f(x)=-2log(Likelihood(x|Data))-ChiSquare Quantile( 1-alpha, 1).
Where x is a real number and the Data is a univariate sample
Is there any build in JSL function I can use? Or at least something similar?
I couldn`t find anything on the web or in the scripting index.
I would really appreciate some suggestions.
Thanks in advance
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Calculating roots of a function
See Help about the Minimize() function. Your expression is Abs( -2log(Likelihood(x|Data))-ChiSquare Quantile( 1-alpha, 1) ). This numerical optimization should be able to solve for the roots. The easiest way would be to use a Script Editor. Select File > New > Script. Right-click and select Show Embedded Log. This way the result of the function call will be shown in the same window.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Calculating roots of a function
See Help about the Minimize() function. Your expression is Abs( -2log(Likelihood(x|Data))-ChiSquare Quantile( 1-alpha, 1) ). This numerical optimization should be able to solve for the roots. The easiest way would be to use a Script Editor. Select File > New > Script. Right-click and select Show Embedded Log. This way the result of the function call will be shown in the same window.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Calculating roots of a function
Thanks for the answer,
the Minimize function seems to be seems to be a little unstable in extreme situations.
However, your tip gave me a good starting point to come up with a solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Calculating roots of a function
Minimize(Abs(function)) can behave badly in some cases. JMP should really add a bracketed root solver, along the lines of uniroot() in R. Until that happens, Ridders' method ( Ridders' method - Wikipedia ) can be programmed in jsl. It is nearly as efficient as Brent's method ( Brent's method - Wikipedia ), but easier to program. Numerical Recipes includes an implementation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Calculating roots of a function
Why don't you add this suggestion to the Wish List discussion? Search first to see if anyone else has already suggested it and vote for it (kudo). If no one else has, then add it for consideration. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Calculating roots of a function
Done last week add function to find a root (zero) of a function