Chapter Contents |
Previous |
Next |
HISTOGRAM Statement |
See CAPBTA2 in the SAS/QC Sample Library |
You can use a beta distribution to model the distribution of a quantity that is known to vary between lower and upper bounds. In this example, a manufacturing company uses a robotic arm to attach hinges on metal sheets. The attachment point should be offset 10.1 mm from the left edge of the sheet. The actual offset varies between 10.0 and 10.5 mm due to variation in the arm. Offsets for 50 attachment points are saved in the following data set:
data measures; input length @@; label length = 'Attachment Point Offset in mm'; datalines; 10.147 10.070 10.032 10.042 10.102 10.034 10.143 10.278 10.114 10.127 10.122 10.018 10.271 10.293 10.136 10.240 10.205 10.186 10.186 10.080 10.158 10.114 10.018 10.201 10.065 10.061 10.133 10.153 10.201 10.109 10.122 10.139 10.090 10.136 10.066 10.074 10.175 10.052 10.059 10.077 10.211 10.122 10.031 10.322 10.187 10.094 10.067 10.094 10.051 10.174 ;The following statements create a histogram with a fitted beta density curve:
title 'Fitted Beta Distribution of Offsets'; legend1 frame cframe=ligr cborder=black position=center; proc capability data=measures noprint; specs usl=10.25 lusl=20 cusl=salmon clsl=salmon cright=yellow pright=solid; histogram length / beta(theta=10 scale=0.5 color=blue fill) cfill = ywh HREF=10 hreflabel = 'Lower Bound' lHREF=2 vaxis = axis1 cframe = ligr legend = legend1; axis1 label=(a=90 r=0); inset n = 'Sample Size' beta(pchisq = 'P-Value') / pos=ne cfill = blank; run;The histogram is shown in Output 4.1.1. The THETA= beta-option specifies the lower threshold. The SCALE= beta-option specifies the range between the lower threshold and the upper threshold (in this case, 0.5 mm). Note that in general, the default THETA= and SCALE= values are zero and one, respectively. Output 4.1.1: Superimposing a Histogram with a Fitted Beta Curve
The HREF=option draws a reference line at the lower bound, and the HREFLABEL= option adds the label Lower Bound. The option LHREF=2 specifies a dashed line type. The INSET statement adds an inset with the sample size and the p-value for a chi-square goodness-of-fit test.
In addition to displaying the beta curve, the BETA option summarizes the curve fit, as shown in Output 4.1.2. The output tabulates the parameters for the curve, the chi-square goodness-of-fit test whose p-value is shown in Output 4.1.1, the observed and estimated percents above the upper specification limit, and the observed and estimated quantiles. For instance, based on the beta model, the percent of offsets greater than the upper specification limit is 6.6%. For computational details, see "Formulas for Fitted Curves".
Output 4.1.2: Summary of Fitted Beta Distribution
Chapter Contents |
Previous |
Next |
Top |
Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.