# Lazarus

## Programming => LCL => Topic started by: GeorgeSteven on September 27, 2021, 09:26:42 am

Title: Calculating UCL (Upper Control Limit) and LCL (Lower Control Limit)
Post by: GeorgeSteven on September 27, 2021, 09:26:42 am
I would like to know the opinion of the forum in the following case.
I am trying to calculate the UCL and LCL for a set of measurements.
I took one measurement per day, three months in a row.
For calculating the limits, I used the following procedure:

1. Calculate the Average
2. Calculate the Median Range
3. Calculate control limits using following formula:

UCL= Average + 3.14*Median Range
LCL= Average - 3.14*Median Range

I was told that this is the correct way to calculate the UCL and LCL. For your convenience, I attached the excel file with my calculation.
Please, let me know what is your opinion in this case. Is this the correct way or should I do it differently?
Thank you,
Title: Re: Calculating UCL (Upper Control Limit) and LCL (Lower Control Limit)
Post by: wp on September 27, 2021, 09:47:45 am
There is a statistics program, LazStats, on CCR (https://sourceforge.net/p/lazarus-ccr/svn/HEAD/tree/applications/lazstats/). It calculates UCL and LCL in procedure TXBarChartForm.Calculate, unit XBarChartUnit.
Title: Re: Calculating UCL (Upper Control Limit) and LCL (Lower Control Limit)
Post by: prof7bit on October 03, 2021, 10:59:01 am
UCL= Average + 3.14*Median Range
I'm just wondering where the value Pi would come from. Isn't it defined as 3 standard deviations?
Title: Re: Calculating UCL (Upper Control Limit) and LCL (Lower Control Limit)
Post by: wp on October 03, 2021, 11:17:40 am
First of all: I'm not a statistician, so my answer may be wrong...

Basically, your statement is correct, but the question is: What is the value of the standard deviation? Normally for such such control charts, a small sample is pulled from the entire population repeatedly over time. You can calculate the standard deviation of that small sample, but must use statistical arguments to correct this to obtain the "true" standard deviation of the entire population. Or only the range of the values in the sample is taken, like in the OP's text, and again correction factors must be applied to estimate the standard deviation. These correction factors are tabulated in statistics texts for various sample sizes.

Therefore, I think that the factor 3.14 (if it's correct at all) is not pi, but one of these correction factors.