Saturday, May 1, 2021

TI-84 Plus CE and Casio fx-CG50: Confusion Matrix, Practice SAT Questions with Mometrix

TI-84 Plus CE and Casio fx-CG50:  Confusion Matrix, Practice SAT Questions with Mometrix 

Confusion Matrix


In statistical applications, particularly in medicine, we hear about the infection rates of a disease and tests that are created to designate whether people are infected with the disease.  No test, at least not any that I heard of, is 100% accurate in detecting whether a person is infected with a certain virus.  

Tables can be used to summarize the accuracy of a test, measuring one of four outcomes:

true positive (TP):  the person is infected with a virus and the test detects the virus

false negative (FN):  the person is infected with a virus but the test fails to detect it

false positive (FP):  the test states the person is infected when in reality the person does not have the virus

true negative (TN):  the person is not infected and the test accurate detects the person is healthy (does not have the virus)

One of the common names for this type of table is a confusion matrix. 

Two of the many measurements that can be made from a confusion matrix are called sensitivity and specificity.

Sensitivity is the ratio of true positive results against all of the population that is infected.  

Sensitivity = true positive / (true positive + false negative)

Specificity is the ratio of true negative results against all fo the population that is not infected.  

Specificity = true negative / (false negative + true positive)

The program CONFUSE creates two 3 x 3 matrices (see the illustration below):

Matrix A:  Theoretical confusion table.  This takes into consideration the infection rate and test rate and calculates the expected values.

Matrix B:  Simulated confusion table.  The test uses a random number generator to simulate the chance of whether a person is infected by using the infection rate and whether a person's test is correct by using the test rate.  The results will vary.  

TI-84 Plus CE Program: CONFUSE

"EWS 2021-03-10"


DelVar [A]

DelVar [B]






Input "TEST RATE? ",T





























Disp "THEORY [A]"

Pause [A]



Pause [B]

Disp "SENSITIVITY",[B](1,1)/[B](3,1)

Disp "SPECIFICITY",[B](2,2)/[B](3,2)

Casio fx-CG50 Program:  CONFUSE

"EWS 2021-03-13"


{3,3}->Dim Mat A

{3,3}->Dim Mat B





N*C->Mat A[3,1]

N*(1-C)->Mat A[3,2]

Mat A[3,1]+Mat A[3,2]->Mat A[3,3]

Mat A[3,1]*T->Mat A[1,1]

Mat A[3,1]*(1-T)->Mat A[2,1]

Mat A[3,2]*(1-T)->Mat A[1,2]

Mat A[3,2]*T->Mat A[2,2]

Mat A[1,1]+Mat A[1,2]->Mat A[1,3]

Mat A[2,1]+Mat A[2,2]->Mat A[2,3]

For 1->I To N


Mat B[3,1]+(R<=C)->Mat B[3,1]

Mat B[3,2]+(R>C)->Mat B[3,2]


Mat B[3,1]+Mat B[3,2]->Mat B[3,3]

For 1->I To Mat B[3,1]


Mat B[1,1]+(R<=T)->Mat B[1,1]

Mat B[2,1]+(R>T)->Mat B[2,1]


For 1->I To Mat B[3,2]


Mat B[1,2]+(R>T)->Mat B[1,2]

Mat B[2,2]+(R<=T)->Mat B[2,2]


Mat B[1,1]+Mat B[1,2]->Mat B[1,3]

Mat B[2,1]+Mat B[2,2]->Mat B[2,3]


"_Mat _A: THEORY" ⊿

Mat A ⊿


Mat B ⊿


Mat B[1,1]/Mat B[3,1] ⊿


Mat B[2,2]/Mat B[3,2]


Population:  N = 200

Infection Rate:  5%  (enter 0.05)

Successful Test Rate: 80%  (enter 0.80)

Theoretical Matrix (Matrix A):

[[ 8 38 46

2 152 154

10 190 200  ]]

Some simulated results (Matrix B, your results will vary):

Simulation 1:

[[ 7 40 47

1 152 153

8 192 200 ]]

Sensitivity ≈ 0.8750

Specificity ≈ 0.7917

Simulation 2:

[[ 5 34 39

1 160 161

6 194 200 ]]

Sensitivity ≈ 0.8333

Specificity ≈ 0.8247


"Confusion Matrix" Wikipedia.  Last Edited February 27, 2021.   Retrieved March 9, 2021. 

Texas Instruments "Webinar:  Modeling as a Tool To Make Sense of the World Around Us" Presented by Gail Burrill and Tom Dick, Ph.D.  March 9, 2021

University of Nottingham.  "Accuracy Table"  Retrieved March 9, 2021

SAT Practice Problems with Mometrix

In 2018, I mentioned that I was going to practice some SAT questions (  If you are taking the SAT or want to practice, a place to go is Mometrix Test Preparation.  Mometrix has online practice tests for reading, writing, and mathematics, as well as official Sample tests.  

Check them out here:

Their math page which includes a free online practice test:

Many thanks to George Bigelow for the information and site.

Disclaimer:  This is not a paid advertisement.  


All original content copyright, © 2011-2021.  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. 

No comments:

Post a Comment

Update: HP Prime Connectivity Kit and Emulator

  Update: HP Prime Connectivity Kit and Emulator The HP Prime Connectivity Kit and Emulator have been updated.  The version number is 14592 ...