cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
olithun
Level II

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

 

1 ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

5 REPLIES 5

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.

olithun
Level II

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.

 

 

DunnTiger764
Level II

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.

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!

DunnTiger764
Level II

Re: Calculating roots of a function