Showing posts with label quality control. Show all posts
Showing posts with label quality control. Show all posts

Saturday, July 5, 2025

HP 21S and TI-84 Plus CE: Normal Distributions and Hypothesis Tests

HP 21S and TI-84 Plus CE: Normal Distributions and Hypothesis Tests


Let’s compare how calculations involving the normal distribution are done between a classic calculator and a current one. The classic calculator is the rare HP 21S calculator from 1988 and the current calculator is the TI-84 Plus CE.


In 2017 (how time flies!) I wrote a review for the HP 21S (along with it’s cousin HP 20S):

https://edspi31415.blogspot.com/2017/04/retro-review-hewlett-packard-hp-20s-and.html.


Normal Distribution Calculations


z = z-score, point; p = probability, area


Assumptions: The mean is assumed to be 0 while the standard deviation is 1. (μ = 0, σ = 1).


Lower Tail (-∞, z)



HP 21S

TI-84 Plus CE*

Example

Given z, find p

Keystrokes:

1 [ - ] z [ ←| ] (Q(z)) [ = ]

normalcdf(-1E99, z)

Input: z = 0.77
Result:
p ≈ 0.7794

Given p, find z

Keystrokes:

[ ( ] 1 [ - ] p [ ) ] [ |→ ] (zp)

invNorm(p)

Input: p = 0.77
Result:
z ≈ 0.7388


* also includes TI-83 Plus, TI-84 Plus, TI-83 Premium (Python), TI-82 Advanced, and I do believe it is the same syntax for TI-89/Nspire family


Upper Tail (z, +∞)


HP 21S

TI-84 Plus CE*

Example

Given z, find p

Keystrokes:

z [ ←| ] (Q(z))

normalcdf(z, 1E99)

Input: z = 0.49
Result:

p ≈ 0.3121

Given p, find z

Keystrokes:

p [ |→ ] (zp)

InvNorm(1 - p)

Input: p = 0.49
Result:

z ≈ 0.0251


Two Tail (-z, z)


HP 21S**

TI-84 Plus CE*

Example

Given z, find p

Keystrokes:

z [ STO ] [ 0 ] [ +/- ]

[ ←| ] (Q(z)) [ - ]
[ RCL ] 0 [ ←| ] (Q(z)) [ = ]

normalcdf(-z, z)

Input: z = 1
Result:

p ≈ 0.6827

Given p, find z

Keystrokes:

p [ ÷ ] 2 [ = ] [ STO ] 0
Lower Limit:

[ ( ] 0.5 [ - ] [ RCL ] 0 [ ) ] [ |→ ] (zp)
Upper Limit:

[ ( ] 0.5 [ + ] [ RCL ] 0 [ ) ] [ |→ ] (zp)

InvNorm(p, 0, 1, CENTER)

Input: p = 0.25
Result:

Upper: z ≈ 0.3186

Lower: z ≈ -0.3186


** HP 21S: A memory register is needed for this particular algorithm. I use register 0 for this example.



Sample Test of the Mean: Is the Proposed Mean the True Mean? (μ0 = μ)


Perform a significant test of whether a proposed mean (μ0) is the true mean (μ) given data from a sample:


x-bar: arithmetic mean of a sample

σ: population deviation of the sample

n: sample size


In this test, the null or default hypothesis is μ =μ0, while the alternate hypothesis is μ ≠ μ0.


Your confidence level and critical level, α, are complimentary. For example, if you want a 95% confidence level, your critical level, or α, is: α = 1 – 0.95 = 0.05 (5%). This is a two-tail test.


HP 21S

TI-84 Plus CE

[ ←| ] [ ← ] (LOAD) (A) (1-Stat)
n [ XEQ ] D

μ [ R/S ]

σ [ R/S ]



Test Method # 1:

α [ ÷ ] 2 [ = ] [ |→ ] (zp) (= critical value)

μ0 [ XEQ ] B (= test value)


Null: μ0 = x-bar, Alternative: μ0 ≠ x-bar

If test value < critical value, do not reject null hypothesis

If test value > critical value, reject null hypothesis and accept the alternate hypothesis


Test Method # 2:

μ0 [ XEQ ] B [ ←| ] [ 1 ] (Q(z)) (= p)


Null: μ0 = x-bar, Alternative: μ0 ≠ x-bar

If p > α / 2, do not reject null hypothesis

If p < α / 2, reject null hypothesis and accept the alternate hypothesis


Note:

LBL D: store summary statistics for the test of one sample mean or probability. For this test, the standard error that is shown will not be used.


LBL B: calculate the z-score:

z = (x-bar – μ0) / (σ / √n)

[ stat ], TESTS, 1: Z-Test…

Inpt: Stats
(Input shown as Inpt)

μ0: enter μ0

σ: enter σ

x-bar: enter x-bar

n: enter n

Select μ ≠ μ0 (alternate hypothesis)

Select Calculate


Test Method # 1:

critical value: normalcdf(α/2, 1E99)

test value: [ vars ], 5: Statistics…, TEST, 2: z


Null: μ0 = μ, Alternative: μ0 ≠ μ

If test value < critical value, do not reject null hypothesis

If test value > critical value, reject null hypothesis and accept the alternate hypothesis


Test Method # 2:


Compare p to α


Null: μ0 = x-bar, Alternative: μ0 ≠ x-bar

If p > α, do not reject null hypothesis

If p < α, reject null hypothesis and accept the alternate hypothesis


One line command:

Z-Test(μ0, σ, x-bar, n, alt)

alt: -1 for μ0 < μ, 0 for μ0 ≠ μ, 1 for μ0 > μ


Example:

n = 515, μ = 7.65, σ = 3.56

α = 5% = 0.05, μ0 = 7.7, α / 2 = 0.025

[ ←| ] [ ← ] (LOAD) (A)
515 [ XEQ ] D

7.65 [ R/S ]

3.56 [ R/S ]


0.05 [ ÷ ] 2 [ = ] [ |→ ] (zp)

(critical value = 1.9600)

7.7 [ XEQ ] B

(z ≈ -0.3187 < 1.9600)


7.7 [ XEQ ] B [ ←| ] [ 1 ] (Q(z))

(p ≈ 0.6250 > 0.025)


Do not reject null hypothesis

Example:

n = 515, μ = 7.65, σ = 3.56

α = 5% = 0.05, μ0 = 7.7


[ stat ], TESTS, 1: Z-Test…

Inpt: Stats

μ0: 7.7

σ: 3.56

x-bar: 7.65

n: 515

Select μ ≠ μ0

Select Calculate


Results:

μ≠7.7

z=-0.3187304977

p=0.7499310153

x-bar=7.65

n=515



p ≈ 0.7499 > 0.05

z ≈ -0.3187 < 1.9600


Do not reject null hypothesis


This is one of several z-tests that can be performed.


Confidence Interval


Determine a confidence level of where the true mean is located given data from a sample:


x-bar: arithmetic mean of a sample

σ: population deviation of the sample

n: sample size


Confidence Mean:

x-bar ± (z * σ) / √n


z: absolute value of the z-score where the two tail probability equals c.

Using TI-84 Plus CE commands: invNorm(c, 0, 1, CENTER)


HP 21S

TI-84 Plus CE

[ ←| ] [ ← ] (LOAD) (A)
n [ XEQ ] D

μ [ R/S ]

σ [ R/S ]


Confidential Interval:

[ ( ] 1 [ - ] c [ ) ] [ ÷ ] 2 [ = ]

[ |→ ] [ 1 ] (zp)

[ XEQ ] C

→ precision [ R/S ]

→ lower limit [ R/S ]

→ upper limit


Note:

LBL C: Confidence interval

precision = (z * σ) / √n

lower limit = x-bar – precision

upper limit = x-bar + precision

[ stat ], TESTS, 7: Zinterval…


Inpt: Stats (Input is shown as Inpt)

σ: enter σ

x-bar: enter x-bar

n: enter n

C-Level: enter confidence level as a decimal

Calculate


One line command:

ZInterval σ, x-bar, n, c

n = 389, μ = 88.84, σ = 10.25

c = 90% = 0.9

[ ←| ] [ ← ] (LOAD) (A)
389 [ XEQ ] D

88.84 [ R/S ]

10.25 [ R/S ]

[ ( ] 1 [ - ] 0.9 [ ) ] [ ÷ ] 2 [ = ]

[ |→ ] [ 1 ] (zp)

[ XEQ ] C

→ 0.8548 [ R/S ]

→ 87.9852 [ R/S ]

→ 89.6948

n = 389, μ = 88.84, σ = 10.25

c = 90% = 0.9

Inpt: Stats

σ: 10.25

x-bar: 88.84

n: 389

C-Level: 0.9


Result:

(87.985, 89.695)

x-bar = 88.84

n = 389



Sources


CalcBlog “Hypothesis Testing using Z-Test on the TI-83 Plus, TI-84 Plus, TI-89, and Voyage 200” February 6, 2011. https://www.calcblog.com/hypothesis-testing-z-test-on-ti84-ti89-graphing-calculator/ Accessed January 30, 2025.


Hewlett Packard HP-21 Stat/Math Calculator: Owner’s Manual Edition 3. June 1990.


TI-Basic Developer “The Z-Test( Command” http://tibasicdev.wikidot.com/z-test Accessed January 30, 2025.

Enjoy! Until next time,


Eddie


All original content copyright, © 2011-2025. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

Sunday, March 9, 2025

Spotlight: Calculated Industries QR Calc

Spotlight: Calculated Industries QR Calc <Title>


Quick Facts



Model: 3375

Name: QR Calc

Company: Calculated Industries

Timeline: 1993

Type: Quality Control, Statistics

Operating System: Algebraic

Digits: 7

Memory: 1 general purpose memory register plus specific variable registers 

Power: 1 CR-2032 battery





When I purchased the QR Calc, there was no manual with it. Normally, it wouldn’t present any issues because I can often find manuals online. That is not the case with the QR Calc. If there is any manual online, please email me. I’ll have to be more careful next time.



I apologize that I will not be able to describe all the functions but hopefully I describe enough features to give the reader a general idea. Please check out the sources below.



Features



Let’s start with the mathematical functions included: powers and roots (y^x, x². √), natural logarithm (ln), exponential function (e^x), reciprocal (1/x), arithmetic (+, -, ×, ÷), and the standard percent key which operates they people expect it to (%). The order of operations is enforced. Like a lot of calculators, the change sign (+/-) key is a shifted function.



The operating range of the calculator is 7 digits: -9,999,999 to 9,999,999. Any calculator that has a result outside of this range causes the QR calculator to display an error message.



The store key for the QR Calc is labeled [ Set ].



The function →PPM changes any number into n parts per million.

Example: 0.0014 →PPM displays 1,400 PPM.



Here are some functions I was able to find out and figure out:



Normal Distribution



The normal distribution functions calculate areas of the standard normal distribution, assuming that μ = 0 and σ = 1.



n [ nZ ]: lower tail probability (from -∞ to x = n)

n [ 2nd ] (ModZ): probability from x = 0 to x = n



One Variable Statistics



The QR handles a single set of statistics with the following key and key sequences:



[ Add ]: Add a data point (Σ+)

[ 2nd ] [ Add ] (Subtract): Subtract a data point (Σ-)

[ 2nd ] [ + ] (S←→P): Toggle between standard deviation and population deviation (σn indicator)



[ x-bar ]: Calculate the arithmetic mean.

[ R ]: Calculate the range of the data.

[ 2nd ] [ x-bar ] (N): Calculate the number of data points.

[ 2nd ] [ R ] (σ): Calculate the deviation, depending on the deviation mode set.

[ Low ]: Returns the minimum value of the data set entered.

[ 2nd ] [ Low ] (High): Returns the maximum value of the date set entered.



[ Skew ]: Skew. I’m not sure what formula the QR Calc uses because I have not been able to match results with any formula I found yet.

[ 2nd ] [ Skew ] (Kurt): Excess Kurtosis. Kurtosis measures how concentrated the data is with respect to the mean.



The formula used for Excess Kurtosis:

μ4 = 1/n * Σ((xi – mean)^4)

kurtosis = μ4/s^4 – 3



Process Capability Indices



If a process is mature, that is a process that is regular and has been executed for a period of time, we can measure the capability index.



There are two capability indices:



Cp: for a centered analysis

Cpk: for a non-centered analysis. This metric is used for potential future performance.

Generally, we want these indices to be at least 1. Capable processes have an Cp index of 1.33 or higher.



Key strokes:

Enter the mean: [ Set ] [ x-bar ]

Enter the deviation: [ Set ] [ 2nd ] [ R ] ( σ )

Enter the lower specification limit (based on the normal distribution): [ Set ] [ LSL ]

Enter the upper specification limit: [ Set ] [ 2nd ] [ LSL ] (USL)

Each variable entered will have an indicator.



Calculate Cp: [ 2nd ] [ Cpk ] (Cp)

Calculate Cpk: [ Cpk ]



Example:

LSL = - 1, USL = 1, mean = 0.05, deviation = 0.27

[ 2nd ] [ × ] (AC) to clear out the registers if needed

0.5 [ Set ] [ x-bar ] (x-bar indicator is on)

0.27 [ Set ] [ 2nd ] [ R ] ( σ ) (σ indicator is on)

1 [ 2nd ] [ - ] (+/-) [ Set ] [ LSL ] (L indicator is on)

1 [ Set ] [ 2nd ] [ LSL ] (USL) (U indicator is on)



Results:

Cp: 1.234568

Cpk: 1.17284

That is a pretty good process.



Formulas Used:

Cp = (USL -LSL) / (6 * σ)

Cpx = min((x-bar – LSL) / (3 * σ), (USL – x-bar) / (3 * σ))





Control Charts



We get to the main feature of the QR Calc: Control Charts and Capability Limits. On the back of the calculator, the QR Calc has a list of handy formulas.







The heart of the QR Calc is the table of constants that are used in control charts and limit charts. Often the chart limits are built on many samples of n data points each, where x-bar is the average of the sample averages, and R is the average of the range samples. We can also build chart limits with one sample. The QR Calc can only handle sample sizes from 3 to 25 data points.



Mean Control Chart Limits:

Lower: LCL-mean = x-bar – n * A2 * R

Upper: UCL-mean = x-bar + n * A2 * R



R Control Chart Limits:

Lower: LCL-R = n * D3 * R

Upper: UCL-R = n * D4 * R



A2, D3, and D4 are constants used in calculating control chart limits. Accessing these constants takes one argument, which is the sample size.



The A2 constant for a sample size of 3: 3 [ nA2 ] returns 1.023.



Below is a short table of constants, as determined by the QR Calc.



Sample Size n

Constant A2

Constant D3

Constant D4

5

0.577

0

2.114

10

0.308

0.223

1.777

15

0.223

0.347

1.653

20

0.18

0.415

1.585

25

0.153

0.459

1.541



Standard deviation can be estimated by using the average range ( R ) and another constant d2:

σ ≈ R / d2

Sample Size n

Constant d2

5

2.326

10

3.078

15

3.472

20

3.735

25

3.931


A table of constants from n = 2 to 25 can be found here:

https://sixsigmastudyguide.com/x-bar-r-control-charts/



Example:

Construct mean and range charts from a sample (n = 5):

3.995

4.26

4.37

4.44

4.58



Keystrokes:

(after clearing data)

3.995 [ Add ] 4.26 [ Add ] 4.37 [ Add ] 4.44 [ Add ] 4.58 [ Add ]



X-bar chart:

LCL: [ x-bar ] - 5 [ nA2 ] [ × ] [ R ] [ = ] Result: 3.991455

UCL: [ x-bar ] + 5 [ nA2 ] [ × ] [ R ] [ = ] Result: 4.666545



R chart:

LCL: 5 [ 2nd ] [ nD4 ] (nD3) [ × ] [ R ] [ = ] Result: 0

UCL: 5 [ nD4 ] [ × ] [ R ] [ = ] Result: 12.36669

The QC calc has contains the E2 constant.



Final Thoughts



The functions that I still do not know about or have figured out are: TRGa, TRGb, RS a, RS b, %Low, and %High.



This review is incomplete. I will keep searching for a manual, I may have to buy another QR Calc.



This calculator is a rarity, and one worth checking out.






Sources


Hessing, Ted. “Process Capability (Cp & Cpk)” 6σSTUDYGUIDE.COM (no specific date give, first comment on November 19, 2014) https://sixsigmastudyguide.com/process-capability-cp-cpk/. Accessed January 2025.



Hessing, Ted. “X Bar R Control Charts” 6σSTUDYGUIDE.COM (no specific date give, first comment on April 17, 2018) https://sixsigmastudyguide.com/x-bar-r-control-charts/. Accessed January 2025.


Hewlett Packard. HP-65 Stat Pac 2 Cupertino, CA. https://literature.hpcalc.org/items/975 1975




Next time, I’m going to see if a manual comes with it. Not everything has a manual online.




Eddie


All original content copyright, © 2011-2025. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.

Friday, August 25, 2017

HP Prime: Shewhart X-Bar Chart (Quality Chart)

HP Prime:  Shewhart X-Bar Chart (Quality Chart)

Introduction and Calculation

The program XCHART generates five variables that describe the parameters of a Shewhart X-bar chart for quality control purposes.  Two limits, upper and lower, are determined, set 3 deviations from the mean, set the boundaries in which a process can vary and still allow the process to be in control.

The samples are arranged in a matrix.  Each row is a sample, with each column is a data point of those samples.  For example, a 15 x 10 matrix represents 15 samples of with the sample size of 10.

The five parameters calculated are:

MM:  Grand Mean.  The mean of all the sample means. 

Sample mean = Σx / n

RM:  Range Mean.  The mean of all ranges of all samples. 

Range = max(sample) – min(sample)

MD:  Mean Deviation.  The mean of all the standard deviation of all samples.

Sample Deviation = √( (Σx^2 – (Σx)^2/n) / (n – 1)

L, U:  Lower and Upper limit of the x-bar chart.  How it is calculated is dependent on the sample size (number of columns).

If the size ≤ 25, then:

U = MM + a2 * RM
L = MM – a2 * RM

Where a2 is a constant.  The values of a2 for sample sizes 2 – 25 can be found here:  http://onlinelibrary.wiley.com/doi/10.1002/9781119975328.app2/pdf

Some values (2 – 11):
Sample Size
a2
Sample Size
a2
2
1.880
7
0.419
3
1.023
8
0.373
4
0.729
9
0.337
5
0.577
10
0.308
6
0.483
11
0.285

HP Prime Program XCHART

EXPORT XCHART(mat)
BEGIN
// 2017-08-25 EWS
// Quality control
// {grand mean, range mean,
// std.dev mean, LCL, UCL}

// Grand mean
LOCAL MM:=mean(mean(TRN(mat)));

// Average range
LOCAL RM,C,R,I,L,cl;
// sample size: columns
C:=colDim(mat);
// number of samples
R:=rowDim(mat);

FOR I FROM 1 TO R DO
cl:=row(mat,I);
RM:=RM+(MAX(cl)-MIN(cl));
END;
RM:=RM/R;

// Average deviation
LOCAL MD:=mean(stddev(TRN(mat)));


// Estimate LCL,UCL

LOCAL U,L;
IF C≤25 THEN
// a2 list for sample size 2-25
LOCAL a;
LOCAL a2:={1.88,1.023,.729,
.577,.483,.419,.373,.337,.308,
.285,.266,.249,.235,.223,
.212,.203,.194,.187,.18,.173,
.167,.162,.157,.153};
a:=a2(C-1);
L:=MM-a*RM;
U:=MM+a*RM;
ELSE
// c4 (C>25)
LOCAL c4:=√(2/(C-1))*((C/2-1)!/
((C-1)/2-1)!);
U:=MM+3*MD/(c4*√C);
L:=MM-3*MD/(c4*√C);
END;
// Results
RETURN {MM,RM,MD,L,U};
END;

Example:

Data Process 6 samples of 6 data points each:

9.48
10.07
10.98
8.9
11.53
11.05
10.04
8.78
10.8
9.45
11.34
8.9
10.75
10.48
10.08
9.36
10.61
9.92
10.05
8.99
10.00
8.33
9.3
9.77
9.65
9.41
10.08
8.91
11.43
9.08
9.74
9.08
11.17
11.21
9.94
8.89

Since the sample size is not greater than 25, the range is used, with a2 = 0.483 (for the size of 6).

Results:
MM = 9.93194444444
RM = 2.19
MD = 0.785268047476
L = 8.87417444444  (lower limit)
U = 10.9897144444  (upper limit)

According to the results, the process needs further investigation.

Sources:

Aczel, Amir D. and Sounderpandian, Jayavel.  Complete Business Statistics McGraw-Hill Irwin: Boston. 2006.  ISBN 13: 978-0-07-286882-1

“6.3.2.  What Are Variables Control Charts?”  Engineering Statistics Handbook.  http://www.itl.nist.gov/div898/handbook/pmc/section3/pmc32.htm
Retrieved August 24, 2017

Six Sigma Improvement with Minitab  “Appendix 2: Factors for control charts” Published on line June 22, 2011.   http://onlinelibrary.wiley.com/doi/10.1002/9781119975328.app2/pdf   Retrieved August 24, 2017

Eddie


This blog is property of Edward Shore, 2017.

RPN: DM32 and DM42: Stopping Sight Distance (Metric)

RPN: DM32 and DM42: Stopping Sight Distance (Metric) The Stopping Sight Distance Formula – Derivation The stopping sight di...