cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
ChernoffTurtle7
Level III

How to get exact cumulative Prob at specified value in CDF Plot?

For attached example, how to get the exact cumulative Prob at specified value(500) in CDF Plot?

Thanks!

ChernoffTurtle7_0-1722227853858.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: How to get exact cumulative Prob at specified value in CDF Plot?

One option is to use Crosshair toolbar tool

jthi_0-1722229523647.png

 

-Jarmo

View solution in original post

4 REPLIES 4
jthi
Super User

Re: How to get exact cumulative Prob at specified value in CDF Plot?

One option is to use Crosshair toolbar tool

jthi_0-1722229523647.png

 

-Jarmo
jthi
Super User

Re: How to get exact cumulative Prob at specified value in CDF Plot?

You can also script it and get an approximate value

Names Default To Here(1);

dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");

dist = dt << Distribution(Column(:NPN1), CDF Plot(1));
fb = Report(dist)["CDF Plot",FrameBox(1)];

ls = fb << Find Seg(LinesSeg(1));

m = ls << get lines;

xval = 115;

idx = Loc Min(m[0, 1] - xval < 0) - 1;
val = m[idx, 2];

show(val);

// Report(dist)["CDF Plot",AxisBox(1)] << Add Ref Line(val);
// Report(dist)["CDF Plot",AxisBox(2)] << Add Ref Line(xval);

You might want to refine the logic how the specific value is calculated from the m matrix

-Jarmo
hogi
Level XII

Re: How to get exact cumulative Prob at specified value in CDF Plot?

wow, that's powerful!

jthi
Super User

Re: How to get exact cumulative Prob at specified value in CDF Plot?

This goes much off the topic but I tried to do something similar for Graph Builder which uses LineSeg instead of LinesSeg. Due to the smoothing it gets much more difficult and it is time for me to give up (at least for now). Attached is the script and I left some of my "working notes" as commented out code and the code isn't optimized at all.

jthi_1-1722354318500.png

 

View more...
/*""" Attempt to get y-value from Graph Builder LineSeg

Author: jthi
Creation Date: 2024-07-30
Creation JMP Version: JMP Pro 18.0.0

Description: 
	Original post which gave me this idea (LinesSeg)
	https://community.jmp.com/t5/Discussions/How-to-get-exact-cumulative-Prob-at-specified-value-in-CDF-Plot/m-p/777203
	
"""*/

Names Default To Here(1);
// https://community.jmp.com/t5/JMPer-Cable/Understanding-cubic-splines/ba-p/39511 can be interesting read

dt = Open("$SAMPLE_DATA/Semiconductor Capability.jmp");

slider_x = 200;

nw = New Window("Test",
	V List Box(align("center"),
		V List Box(
			Text Box("Adjust to change X"),
			Slider Box(110, 530, slider_x, nw << update window, << Set Width(1000));
		),
		Text Box("Change graph builder smoother settings to see changes to see different fits"),
		gb = dt << Graph Builder(
			Size(1000, 600),
			Show Control Panel(1),
			Fit To Window("On"),
			Variables(X(:PNP1), Y(:NPN1)),
			Elements(Smoother(X, Y, Legend(4)))
		);
	);
);

fb = Report(gb)[FrameBox(1)];

/*
ls = fb << Find Seg(LineSeg(1));
m_x = ls << Get X Values;
m_y = ls << Get Y Values;
smooth = ls << Get Smoothness;

idx = Loc Sorted(m_x, Matrix(xval))[1];
// {Estimates, Std_Error, Diagnostics} = Linear Regression(m_y[idx::idx+1], m_x[idx::idx+1]);
// yval = Estimates[2] * xval + Estimates[1];
idx = Loc Sorted(m_x, Matrix(xval))[1];
yval = Interpolate(xval, m_x, m_y);
Report(gb)[AxisBox(1)] << Add Ref Line(xval);
Report(gb)[AxisBox(2)] << Add Ref Line(yval);
*/


/*
m_x[2::N Rows(m_x)::2] - m_x[1::N Rows(m_x) - 1::2]
m_y[2::N Rows(m_y)::2] - m_y[1::N Rows(m_y) - 1::2]
sl = Spline Smooth(m_x, m_y, smooth);
*/


Report(gb)[FrameBox(1)] << Add Graphics Script(
	ls = fb << Find Seg(LineSeg(1));
	m_x = ls << Get X Values;
	m_y = ls << Get Y Values;
	Marker(Marker State(3), m_x, m_y);
	Pen Size(1);
	Line(m_x, m_y);
	
	yval = Interpolate(slider_x, m_x, m_y);
	
	Marker Size(5);
	Marker(Marker State(12), {slider_x, yval});
	V Line(slider_x);
	H Line(yval);
	
	Text(Right Justified, Eval List({slider_x, yval + 1}), Eval Insert("(^Round(slider_x, 3)^, ^Round(yval, 3)^)"));
	
	peaks = m_y[1::N Rows(m_y) - 2] < m_y[2::N Rows(m_y) - 1] & m_y[2::N Rows(m_y) - 1] > m_y[3::N Rows(m_y)] |
	m_y[1::N Rows(m_y) - 2] > m_y[2::N Rows(m_y) - 1] & m_y[2::N Rows(m_y) - 1] < m_y[3::N Rows(m_y)];
	peak_idx = Loc(peaks) + 1;
	Marker Size(3);
	Fill Color("Red");
	Marker(Combine States(Color State("Red"), Marker State(15)), m_x[peak_idx], m_y[peak_idx]);
);

 

 

-Jarmo