Extract slope and intercept from Summary of FitHi all,
I need to create a script that extracts slope and intercept from Summary of Fit and then uses them to calculate a cutoff value for my variable.
The user will first imput filters and remove outliers. When satisfied with the data points, he/she presses a button and get the slope and interecept as shown in Summary of fit, to be used for the cutoff calculation.
Can anybody help me?
Re: Extract slope and intercept from Summary of Fithere is my code so far.
It works as is, just I'd like to get both slope and intercept from Num Col Box(7) and I can't figure out what's wrong with int = num(word(1, eq2)). It returns no number, so I'm getting the intercept from Outline Box(2).
I attach the template xml.
dt = Current Data Table();
biv = dt << Bivariate(Y(:variable1), X(:Conc A), Fit Line());
rbiv=report(biv);
eq1=rbiv[Outline Box(2)][1, 1] << get text;
eq2=rbiv[Number Col Box(7)] << get text;
slope = num(word(2, eq2));
int = num(word(3, eq1)); //I'd like to get both numebers from Number Col Box (7), but if set int = num(word(1, eq2)) I get nothing.
Cutoff = int+slope*2.5;
Eval(
Eval Expr(
:variable1 << Set Property(
"Spec Limits",
{LSL( Expr( Cutoff ) ), USL( Expr( . ) ), Target( Expr( . ) ),
Show Limits( 1 )}
)
)
);
Re: Extract slope and intercept from Summary of FitYes. If the XML template exists, you can use 'LoadTextFile()', make the changes and insertions you require using JSL, then use 'SaveTextFile()'. Look in 'Help > Scripting Index' for details of these JSL expressions.
I'm sure you would get more speciifc guidance if you are able to provide an example.
Re: Extract slope and intercept from Summary of FitThank you for the link, it's very usefult.
The cutoff is a predefined concentration of analyte, so once the intercept and slope are known, it's easily determined. I'd like to add it to my y as a specification limit but the ultimate goal would be to fill in an xml template with slope and interecept. Is there any way to fill in xml files with jmp?
Re: Extract slope and intercept from Summary of Fit@francescaz :
In order to get the data from summary of fit , please refer to here
https://community.jmp.com/t5/Discussions/JSL-A-script-that-extracts-textbox-information-from-a-bivariate/td-p/13016
As for definition of cutoff point , can you define the conditions or share what you have ?
Best
Uday