cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
New to using JMP? Hit the ground running with the Early User Edition of Discovery Summit. Register now, free of charge.
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar
Sebastienlg
Level II

Help: JMP Script: Coefficient calculation based on a column switcher selection

Hello everyone,

I need some help in order to adapt my P' chart of Laney for events.

 

Below is my code:

 

Firstly, I need to determine a z_KSigmaZ coefficient based on the Y1 column with these lines:

 

z_yyy = Eval( {: "Y1" } );
z_xx = z_yyy[1] << get values;
z_nnn = Eval( {:Nombre de seringues} );
z_nn = z_nnn[1] << get values;
z_rrr = Eval( {:Numéro de lot} );

z_Proportion = E Div( z_xx, z_nn );
z_Pbar = V Sum( z_xx ) / V Sum( z_nn );
z_sigma_est = Root( z_Pbar * (1 - z_Pbar) );
z_zvalue = E Mult( ((z_Proportion - z_Pbar) / z_sigma_est), Root( z_nn ) );
z_nr = N Row( z_zvalue );
z_mRList = {0};
z_m = z_zvalue;
z_m[1, 0] = [];
z_m = z_m |/ [0];
z_mr = Abs( z_m - z_zvalue );
z_nr = N Row( z_mr );
z_mr[z_nr, 0] = [];
z_SigmaZ = Mean( z_mr ) / 1.128;
z_KSigmaZ = 3 * z_SigmaZ;

then, I am creating the P' chart of Laney with a column switcher:

 

 

	Graph=Expr(Control Chart(
				Sample Label( :Numéro de lot ),
				Sample Size( :Nombre de seringues ),
				KSigma(TBD),
				Sort by Row Order( 1 ),
			Chart Col( :"Y1", P( Test Beyond Limits( 1 ), Limits Precision( 1 ), LCL( -3 ) ) ),
	SendToReport(
		Dispatch(
			{},
			"P of Y1",
			OutlineBox,
			{Set Title( "p'-chart, p of Y1" )}
		),
		Dispatch(
			{"P of Y1"},
			"2",
			ScaleBox,
			{Format( "Fixed Dec", 12, 5 ), Min( -0.00025 ), Max( 0.0025 ),
			Inc( 0.00025 ), Minor Ticks( 1 )}
		),
		Dispatch(
			{"P of Y1"},
			"1",
			ScaleBox,
			{Min( 0.5 ), Inc( 1 ), Minor Ticks( 0 )}
		),
		Dispatch(
			{"P of Y1"},
			"",
			AxisBox,
			{Add Axis Label( "Taux de défauts pour Y1" )}
		),
		Dispatch(
			{"P of Y1"},
			"Proportion",
			TextEditBox,
			{Set Text( "Taux de défauts pour Y1" )}
		),
		);
		);
		);
	SubstituteInto(graph, Expr(TBD), z_KSigmaZ);
	ColumnSwitcherObject = graph << Column Switcher( :Y1,{:Y1, :Y2});

However, I don't know how to calculate the right z_KSigmaZ coefficient based on the column selected with the column switcher.

Do you have an idea to help me with this?

Thank's a lot for your answer,

Sebastien

 

3 REPLIES 3
ian_jmp
Staff

Re: Help: JMP Script: Coefficient calculation based on a column switcher selection

If I understand correctly, you will need 'Make Column Switch Handler()'. Do 'Help > Scripting Index', search for this, and take a look at the example.

Sebastienlg
Level II

Re: Help: JMP Script: Coefficient calculation based on a column switcher selection

Yes it would be something like the 'Make Column Switch Handler()'.

However, I would like to apply it for the coefficient calculation and not a chart..

Is there a way to make it?

 

Sebastienlg
Level II

Re: Help: JMP Script: Coefficient calculation based on a column switcher selection

I tried this code:

		//Calcul du Zsigma
z_yyy = Eval( {:"Y1"n} );
z_xx = z_yyy[1] << get values;
z_nnn = Eval( {:Nombre de seringues} );
z_nn = z_nnn[1] << get values;
z_rrr = Eval( {:Numéro de lot} );

z_Proportion = E Div( z_xx, z_nn );
z_Pbar = V Sum( z_xx ) / V Sum( z_nn );
z_sigma_est = Root( z_Pbar * (1 - z_Pbar) );
z_zvalue = E Mult( ((z_Proportion - z_Pbar) / z_sigma_est), Root( z_nn ) );
z_nr = N Row( z_zvalue );
z_mRList = {0};
z_m = z_zvalue;
z_m[1, 0] = [];
z_m = z_m |/ [0];
z_mr = Abs( z_m - z_zvalue );
z_nr = N Row( z_mr );
z_mr[z_nr, 0] = [];
z_SigmaZ = Mean( z_mr ) / 1.128;
z_KSigmaZ = 3 * z_SigmaZ;
//

And then, I wanted to create my column switcher on the z_yyy coefficient:

Column = z_yyy << Column Switcher( :"Y1"n,{:"Y1"n, :"Y2"n, :"Y3"n, :"Y4"n ,"Y5"n ,"Y6"n});

However, I get a message error because the script is not applied on an object...

 

Do you have a solution for me?

I can't see how I can use the Make Column Switch Handler....

 

Sebastien