JMSL Chart Programmer’s Guide
XbarR and RChart
If the sample sizes are small, say less than 10, then the in-sample ranges can be used instead of the in-sample standard deviations. The XbarR class plots the mean of each sample as well as control limits computed using the mean of the in-sample ranges. The positions of the control limits are determined by the equations
where is the grand mean (the average of all observations), and d2 is the mean of the distribution of the ranges of n samples from the normal distribution with mean of zero and standard deviation of one. The standard deviation of this distribution is d3. Therefore
is an estimator of the standard deviation of the ranges.
XbarR Example
This example creates an XbarR chart using the same piston ring data previously used for the XbarS chart. Here the in-sample ranges are used to compute the control limits, rather than the in-sample standard deviations (Montgomery 215).
View code file
 
import com.imsl.chart.*;
import com.imsl.chart.qc.*;
 
public class SampleXbarR extends JFrameChart {
public SampleXbarR() {
Chart chart = getChart();
AxisXY axis = new AxisXY(chart);
XbarR xbarr = new XbarR(axis, SampleXbarS.diameter);
xbarr.getUpperControlLimit().setTitle("ucl = {0,number,0.0000}");
axis.getAxisX().getAxisTitle().setTitle("Sample Number");
axis.getAxisX().getAxisLabel().setTextFormat("0");
axis.getAxisY().getAxisTitle().setTitle("Piston Ring Diameter");
axis.getAxisY().setAutoscaleInput(axis.AUTOSCALE_OFF);
axis.getAxisY().setWindow(73.985, 74.015);
}
public static void main(String argv[]) {
new SampleXbarR().setVisible(true);
}
}
XbarRCombo Example
This example combines the XbarR chart with the corresponding RChart into a single chart. This is done by adjusting the Viewport attribute values for the two subcharts (Montgomery 215).
View code file
 
import com.imsl.chart.*;
import com.imsl.chart.qc.*;
 
public class SampleXbarRCombo extends JFrameChart {
public SampleXbarRCombo() {
Chart chart = getChart();
ShewhartControlChart charts[] =
XbarR.createCharts(chart, SampleXbarS.diameter);
AxisXY axis = (AxisXY)(charts[0].getAxis());
axis.getAxisY().setAutoscaleInput(axis.AUTOSCALE_OFF);
axis.getAxisY().setWindow(73.985, 74.015);
}
public static void main(String argv[]) {
new SampleXbarRCombo().setVisible(true);
}
}