Here is a simple example that
- Populates the Control Limits for a column
- Runs a Distribution Platform
- Adds the Control Limits from the displayed column on the graphical output
names default to here(1);
// Open a sample data table
dt=open("$SAMPLE_DATA/big class.jmp" );
// Add a column to be used as the subgroup
dt << new column( "group", formula(Mod(Row(), 4)));
// Add the Control Limits columns to the data table
dt << new column("Center Line", set values({62.55}));
dt << new column("Lower Limit", set values({58.08}));
dt << new column("Upper Limit", set values({67.02}));
// Set the name of the Height column to match the previously distributed
// code
dt:height << set name("X");
// Set the column Property for the Control Limits
Eval(
Substitute(
Expr(
:X << Set Property(
"Control Limits",
{XBar( avg( __avg__ ), LCL( __LCL__ ), UCL( __UCL__ ) )}
)
),
Expr( __avg__ ), :Center Line[1],
Expr( __LCL__ ), :Lower Limit[1],
Expr( __UCL__ ), :Upper Limit[1]
)
);
// Run a platform that creates a graph
dist = Distribution( Continuous Distribution( Column( :X ) ) );
// Extract the Control Limits from the column
contLimits = :X << get property("Control Limits");
// Parse through the returned Limits to get the LCL, UCL and Avg
contLimits=char(contLimits);
found=contains(contLimits,"XBar");
contLimits=substr(contLimits,found+5);
found=contains(contLimits,"avg");
contLimits=substr(contLimits,found+4);
theAvg = num( word(1,contLimits,")"));
found=contains(contLimits,"LCL");
contLimits=substr(contLimits,found+4);
theLCL = num( word(1,contLimits,")"));
found=contains(contLimits,"UCL");
contLimits=substr(contLimits,found+4);
theUCL = num( word(1,contLimits,")"));
// Add reference lines to the graph with the Control Limit values
report(dist)[AxisBox(1)] << add ref line(theLCL,Solid,Black,"LCL");
report(dist)[AxisBox(1)] << add ref line(theUCL,Solid,Black,"UCL");
report(dist)[AxisBox(1)] << add ref line(theAvg,Solid,Black,"Ave");
Jim