Calculation formulas
Welcome to the KensoBI datasource math formula documentation! This documentation contains comprehensive information about the available mathematical formulas and their SQL implementation.
Table of Contents
- Sample Mean Formula
- Average Range Formula
- Standard Deviation Formulas
- Mean of Means Formula
- Capability Indices Formulas
- Control Limits Calculation
Sample Mean Formula
The sample mean () is a measure of central tendency, representing the average value of a set of sample data.
Formula
The formula for the sample mean is given by:
Where:
- is the sample mean,
- is the number of data points in the sample,
- represents each individual data point.
In this formula, represents the sum, and denotes the mean.
SQL query:
'avg(measurementValue) as sampleAgg'
Average Range Formula
The average range () in statistical process control is calculated as the average of the individual ranges. The range is the difference between the maximum and minimum values in a sample.
Formula
The formula for average range is given by:
Where:
- is the average range,
- are the individual ranges in each of the samples, and
- is the number of samples.
This formula represents the central tendency of the range values and is commonly used in control chart calculations, such as in the context of an R-chart in statistical process control.
SQL query:
'max(sampleAgg)-min(sampleAgg) as range'
Standard Deviation Formulas
The standard deviation () is a measure of the amount of variation or dispersion in a set of values.
Population Standard Deviation Formula
The formula for the population standard deviation is given by:
Where:
- is the population standard deviation,
- is the number of data points in the population,
- represents each individual data point,
- is the mean of the population.
Sample Standard Deviation Formula
The formula for the sample standard deviation is given by:
Where:
- is the sample standard deviation,
- is the number of data points in the sample,
- represents each individual data point,
- is the mean of the sample.
In both formulas, denotes the square root, represents the sum, and denotes the mean.
SQL query:
'stddev_pop(sampleAgg) as stdDev'
Sample Range Formula
The sample range () is a measure of the spread or dispersion of a set of sample data.
Formula
The formula for the sample range is given by:
Where:
- is the sample range,
- is the maximum value in the sample,
- is the minimum value in the sample.
In this formula, represents the maximum value, and represents the minimum value in the sample.
SQL query:
'max(sampleAgg)-min(sampleAgg) as range'
Mean of Means Formula
The mean of means () is a measure that represents the average of sample means across multiple groups or samples.
Formula
The formula for the mean of means is given by:
Where:
- is the mean of means,
- is the number of groups or samples,
- represents the mean of the group or sample.
In this formula, represents the sum, and denotes the mean of means.
SQL formula:
'avg(sampleAgg) as mean'
Capability Indices Formulas
Capability indices are statistical measures used to assess the ability of a process to meet specifications.
Cp Formula
The Cp (Process Capability) index is calculated as:
SQL query:
'(c.usl - c.lsl)/(6*stddev_pop(sampleAgg)) as cp'
Pp Formula
The Pp (Potential Process Capability) index is calculated as:
SQL query:
'((c.nominal + c.usl) - (c.nominal + c.lsl)) / (6 * stddev_pop(sampleAgg)) AS pp'
Cpk Formula
The Cpk (Process Capability Index) index is calculated as:
SQL query:
'LEAST (((c.nominal + c.usl) - avg(sampleAgg))/(3*stddev_pop(sampleAgg)), (avg(sampleAgg) - (c.nominal + c.lsl))/(3*stddev_pop(sampleAgg))) as cpk'
Ppk Formula
The Ppk (Potential Process Capability Index) index is calculated as:
SQL query:
'LEAST (((c.nominal + c.usl) - avg(sampleAgg))/(3 * stddev_pop(sampleAgg)), (avg(sampleAgg) - (c.nominal + c.lsl))/(3*stddev_pop(sampleAgg))) as ppk'
Control Limits Calculation
It's important to note that X-bar charts can have up to four control limits, depending on the type of chart and the desired analysis.
X-bar charts
The control limits for X-bar charts are calculated as follows:
SQL query:
'avg(sampleAgg) + ($a2_xbar_limit_range * (max(sampleAgg)-min(sampleAgg))) as ucl_rbar'
'avg(sampleAgg) + ($a3_xbar_limit_sigma * stddev_pop(sampleAgg)) as ucl_sbar'
SQL query:
'avg(sampleAgg) - ($a2_xbar_limit_range * (max(sampleAgg)-min(sampleAgg))) as lcl_rbar'
'avg(sampleAgg) - ($a3_xbar_limit_sigma * stddev_pop(sampleAgg)) as lcl_sbar'
R-bar charts
For R-bar charts, the control limits are calculated as follows:
SQL query:
'$d4_range_ucl * (max(sampleAgg)-min(sampleAgg)) as ucl'
'$d3_range_lcl * (max(sampleAgg)-min(sampleAgg)) as lcl'
S-bar charts
For S-bar charts, the control limits are calculated as follows:
SQL query:
'$b4_sigma_ucl * stddev_pop(sampleAgg) as ucl'
'$b3_sigma_lcl * stddev_pop(sampleAgg) as lcl'
Constants
The values are constants configured for calculations in the SPC panel. The values are also available as an SQL script.