Dew Stats Master .NET
QCPChart Routines
Summary
Constructs P-Chart.

Unit
StatControlCharts

Declaration
Procedure QCPChart(Data: TVec; SampleSize: TVec; DrawVec: TVec; out CL: TSample; UCL, LCL: TVec; Confidence: TSample = 0.997);
 Parameter  Description 
Data Data to be analyzed. Each value represents number of defects. 
Confidence Confidence level for upper and lower control limit. Confidence must lie in the (0,1) interval. 
Samplesize Sample size. Can be integer or vector. 
DrawVec Returns values to be drawn. 
CL Returns control Chart centerline. 
UCL Returns control Chart upper control limit. 
LCL Returns control Chart lower control limit. 

Description
In this case each sample can have different size. You must store sizes in SampleSize vector. An exeption is raised if Data and SampleSize length do not match.
Categories
Control charts
 See Also 
TQCSeries 
QCNPChart 
QCUChart 
QCCChart 

Example 1

The following code will create P chart:

Uses StatControlCharts, MtxExp, Math387, MtxVecTee, StatSeries; procedure Example(Series1: TQCSeries); var CL, UCL, LCL : TSample; Data: Matrix; DrawVec: Vector; begin Data.LoadFromFile('data.mtx'); QCPChart(Data,DrawVec,CL,UCL,LCL,0.05); // setup limit lines Series1.UCL := UCL; Series1.LCL := LCL; Series1.CL := CL; // now draw actual data DrawValues(DrawVec,Series1); end;
#include "StatSeries.hpp" #include "MtxVecTee.hpp" #include "MtxVecCpp.h" #include "StatControlCharts.hpp" #include "Math387.hpp" void __fastcall Example(TQCSeries* Series1) { Vector DrawVec; Matrix Data; double cl,lcl,ucl; QCPChart(Data,DrawVec,cl,ucl,lcl,0.05); // Setup series properties Series1->UCL = ucl; Series1->LCL = lcl; Series1->CL = cl; DrawValues(DrawVec,Series1,0,1,false); }
using Dew.Math; using Dew.Math.Units; using Dew.Stats.Units; namespace Dew.Examples { private void Example(Dew.Stats.QCSeries QCSeries1) { Vector drawvec = new Vector(0); Matrix data = new Matrix(0,0); double cl,lcl,ucl; StatControlCharts.QCPChart(data,drawvec,out cl,out ucl,out lcl,0.05); // Setup series properties QCSeries->UCL = ucl; QCSeries->LCL = lcl; QCSeries->CL = cl; MtxVecTee.DrawValues(drawVec,QCSeries1,0,1,false); } }



Declaration
Procedure QCPChart(Data: TVec; SampleSize: Integer; DrawVec: TVec; out CL, UCL, LCL: TSample; Confidence: TSample = 0.997);

Description
Calculates the P-Chart (Control chart for proportions) drawing values, center line, upper and lower control limits. Control limits are based on the normal approximation to the binomial distribution. When p is small, the normal approximation may not always be adequate. In such cases, we may use control limits obtained directly from a table of binomial probabilities. If

is small, the lower control limit obtained from the normal approximation may be a negative number. If this should occur, it is customary to consider zero as the lower control limit.

NOTE: The assumption is all samples have the same SampleSize.

Copyright 2008 Dew Research
http://www.dewresearch.com