StatBean Name: ControlCharts

Purpose: Calculates various types of control charts for both variables and attributes. In some cases, both a location control chart (such as an X-bar chart) and a dispersion control chart (such as an R chart) are created. In other cases, only a single chart is created (such as a P chart).

DataSource: any.


Read/Write Properties
NameTypeDescriptionPossible ValuesDefault Value
chartModeStringMethod for calculating control limits."Initial Study",
"Control to Standard",
"User Specified Limits"
"Initial Study"
chartTypeStringType of control chart to create."X-bar and R",
"X-bar and S",
"X-bar and S-squared",
"X and MR(2)",
"P",
"NP",
"C"
"U"
"X-bar and R"
dataTypeStringFormat of the input data."Observations",
"Subgroup Statistics"
"Observations"
flagRunsAlternatingbooleanWhether to flag unusual runs alternating beyond the outer warning limits.true,falsetrue
flagRunsAboveAndBelowbooleanWhether to flag unusual runs above or below the centerline.true,falsetrue
flagRunsBeyondInnerbooleanWhether to flag unusual runs beyond the inner warning limits.true,falsetrue
flagRunsBeyondOuterbooleanWhether to flag unusual runs beyond the outer warning limits.true,falsetrue
flagRunsUpAndDownbooleanWhether to flag unusual runs up or down.true,falsetrue
flagRunsWithinInnerbooleanWhether to flag unusual runs within the inner warning limits.true,falsetrue
includeLowerLimitChart1booleanWhether to include a lower control limit.true,falsetrue
includeLowerLimitChart2booleanWhether to include a lower control limit.true,falsetrue
includeUpperLimitChart1booleanWhether to include an upper control limit.true,falsetrue
includeUpperLimitChart2booleanWhether to include an upper control limit.true,falsetrue
innerWarningLimitsMultipledoubleNumber of standard errors to place inner warning limits at.> 01.0
lowerSpecificationLimitdoubleLocation of lower specification limit, if any.Any double value.none
nominaldoubleLocation of nominal or target value, if any.Any double value.none
normalizeChartbooleanWhether to chart Z scores rather than sample statistics.true,falsefalse
outerWarningLimitsMultipledoubleNumber of standard errors to place outer warning limits at.> 02.0
recalculateAtPosition1intSubgroup number to recalculate control limits at if Initial Study.0+0
recalculateAtPosition2intSubgroup number to recalculate control limits at if Initial Study.0+0
recalculateAtPosition3intSubgroup number to recalculate control limits at if Initial Study.0+0
recalculateAtPosition4intSubgroup number to recalculate control limits at if Initial Study.0+0
sigmaMultipledoubleNumber of standard errors to place control limits at.> 03.0
standardMeandoubleProcess mean if Control to Standard.Any double value.0.0
standardSigmadoubleProcess standard deviation if Control to Standard.Any double value > 0.1.0
subgroupMeanVariableNameStringThe name of the column containing group means if Subgroup Statistics.Any string."X"
subgroupSizeintSample size if same for all subgroups.1+1
subgroupSizeVariableNameStringThe name of the column containing group indicators if unequal subgroup sizes.Any string."X"
subgroupSpreadVariableNameStringThe name of the column containing group ranges, standard deviations, or variances if Subgroup Statistics.Any string."X"
upperSpecificationLimitdoubleLocation of upper specification limit, if any.Any double value.none
useAverageSubgroupSizebooleanWhether to calculate control limits using average subgroup size.true,falsetrue
userCenterlineChart1doubleCenterline for location chart if User Specified Limits.Any double value.0.0
userCenterlineChart2doubleCenterline for dispersion chart if User Specified Limits.> 0.1.0
userLCLChart1doubleLower control limit for location chart if User Specified Limits.< centerline.-1.0
userLCLChart2doubleLower control limit for dispersion chart if User Specified Limits.>=0 and < centerline.0.0
userUCLChart1doubleUpper control limit for location chart if User Specified Limits.> centerline.1.0
userUCLChart2doubleUpper control limit for dispersion chart if User Specified Limits.> centerline.2.0
unusualRunLengthintThe run size to be flagged on runs up or down and runs above or below.2+8
xVariableNameStringThe name of the column with data if Observations.Any string."X"

Other Public Methods
NameDescriptionArgumentsReturn Value
double getAverageSubgroupSize()Returns the average number of data values in a subgroup.None.Average size.
int getBeyondLimitsChart1(int section)Returns the number of points beyond the control limits.Section number (0-4).Number of points.
int getBeyondLimitsChart2(int section)Returns the number of points beyond the control limits.Section number (0-4).Number of points.
double getCenterlineChart1(int section)Returns the center line of the first chart.Section number (0-4).Centerline.
double getCenterlineChart2(int section)Returns the center line of the second chart.Section number (0-4).Centerline.
double getCp(int section)Returns the estimated capability index.Section number (0-4).Capability index.
double getCpk(int section)Returns the estimated capability index.Section number (0-4).Capability index.
double getCpkLower(int section)Returns the estimated capability index.Section number (0-4).Capability index.
double getCpkUpper(int section)Returns the estimated capability index.Section number (0-4).Capability index.
double getCpm(int section)Returns the estimated capability index.Section number (0-4).Capability index.
double getCr(int section)Returns the estimated capability index.Section number (0-4).Capability index.
void getDataChart1(double xbar[n])Returns the data plotted on the first chart.Double output array.Mean values.
void getDataChart2(double r[n])Returns the data plotted on the second chart.Double output array.Range or sigma values.
double getK(int section)Returns the estimated capability index.Section number (0-4).Capability index.
double getLCLChart1(int section)Returns the lower control limit of the first chart.Section number (0-4).LCL.
double getLCLChart2(int section)Returns the lower control limit of the second chart.Section number (0-4).LCL.
int getNumberOfSections()Returns the number of sections in the charts for which separate limits were calculated.None.Number of sections.
int getNumberOfSubgroups()Returns the number of subgroups with data.None.Number of subgroups.
double getPp(int section)Returns the estimated capability index.Section number (0-4).Capability index.
double getPpk(int section)Returns the estimated capability index.Section number (0-4).Capability index.
double getPpkLower(int section)Returns the estimated capability index.Section number (0-4).Capability index.
double getPpkUpper(int section)Returns the estimated capability index.Section number (0-4).Capability index.
double getPr(int section)Returns the estimated capability index.Section number (0-4).Capability index.
double getProcessMean(int section)Returns the estimated process mean.Section number (0-4).Mean.
double getProcessSigma(int section)Returns the estimated process standard deviation.Section number (0-4).Sigma.
double getUCLChart1(int section)Returns the upper control limit of the first chart.Section number (0-4).UCL.
double getUCLChart2(int section)Returns the upper control limit of the second chart.Section number (0-4).UCL.
int getUnusualRunsChart1(int section)Returns the number of points identified as unusual runs.Section number (0-4).Number of points.
int getUnusualRunsChart2(int section)Returns the number of points identified as unusual runs.Section number (0-4).Number of points.

Output Variables
NameDescription
Chart1DataThe data values for the location control chart.
Chart2DataThe data values for the dispersion control chart, if any.

Code Sample

//create a datasource bean
FileDataSource fileDataSource1 = new STATBEANS.FileDataSource();

//set the file name to be read
fileDataSource1.setFileName("c:\\statbeans\\samples\\spc.txt");

//create a calculation bean
ControlCharts controlCharts1 = new STATBEANS.ControlCharts();

//set the chart type
controlCharts1.setChartType("X-bar and R");

//set the name of the column containing the data
controlCharts1.setXVariableName("strength");

//set the subgroup size (if not 1)
controlCharts1.setSubgroupSize(5);

//set specification limits
controlCharts1.setUpperSpecificationLimit(300.0);
controlCharts1.setNominal(250.0);
controlCharts1.setLowerSpecificationLimit(200.0);

//create a table bean with 19 rows
ControlChartsTable controlChartsTable1 = new STATBEANS.ControlChartsTable();
controlChartsTable1.setNumberOfRowsInDisplay(19);

//set the number of decimal places for displaying the limits
controlChartsTable1.setDecimalPlaces(2);

//create 2 plot beans
ControlChartsPlot controlChartsPlot1 = new STATBEANS.ControlChartsPlot();
ControlChartsPlot controlChartsPlot2 = new STATBEANS.ControlChartsPlot();

//turn off the legends
controlChartsPlot1.setDisplayLimitValues(false);
controlChartsPlot2.setDisplayLimitValues(false);

//set the chart numbers for each plot
controlChartsPlot1.setChartNumber(0);
controlChartsPlot2.setChartNumber(1);

//ask for warning limits on the first chart
controlChartsPlot1.setShowOuterWarningLimits(true);
controlChartsPlot1.setShowInnerWarningLimits(true);

//add a smoother to the second chart
controlChartsPlot2.setSmootherType("EWMA");

//make the calculation bean a listener for changes in the FileDataSource bean
fileDataSource1.addDataChangeListener(controlCharts1.listenerForDataChange);

//make the table and plot beans listeners for changes in the calculation bean
controlCharts1.addDataChangeListener(controlChartsTable1.listenerForDataChange);
controlCharts1.addDataChangeListener(controlChartsPlot1.listenerForDataChange);
controlCharts1.addDataChangeListener(controlChartsPlot2.listenerForDataChange);

//instruct the fileDataSource bean to read the file
fileDataSource1.readData();