Skip to main content
. 2018 Feb 13;6(1):16. doi: 10.3390/healthcare6010016

Table 2.

How to find x and y with matrix algebra.

The equation we need to solve is the following:
Number of people that tested positive in both groups (z) =
the number of true positives (a) + the number of false positives (c)
where
Number of people with an infection in disease group x
Number of people without an infection in control group y
Total number of people in the disease and control groups x + y
Test sensitivity (se) 0.44
Test specificity (sp) 0.99
Number of true positives (a) = x * se x * 0.44
Number of false positives (c) = y * (1 - sp) y * (1-0.99)
Number of people that tested positive in both groups (z) 100 000
which means:
The equation we need to solve is z = x * se + y * (1-sp)
with constraint z = 100 000
se = 0.44
sp = 0.99
y = p*x
p = 2.5
We can solve such equation in excel by using matrix algebra
The system of linear equations we should solve is A * B = C
where
A = 0.44 0.01
−2.5 1
B = x
y
C = 100 000
0
A^-1 = 2.150538 −0.021505
5.376344 0.946237
B = A ^ (-1) * C x = 215 054
y = 537 634
The relationship between y and x (p) = y / x 2.5
Number of people that test positive in the disease group = true positive (a) = x * se 94 624
Number of people that test positive in the control group = false positive (c) = y * (1-sp) 5 376
Number of people that tested positive in both groups (z) = a + c = x * se + y *(1-sp) 100 000
% of people that tested positive in both groups (zz) = (z / ( x + y) )*100 13.29
I have written a user defined function (udf) in VBA that does the above calculations automatically
Lyme1(se ; sp ; p ; z ; output) where output is either "x", "y" or "zz"
Lyme1(0.44;0.99;2.5;100000;"x") x = 215 054
Lyme1(0.44;0.99;2.5;100000;"y") y = 537 634
Lyme1(0.44;0.99;2.5;100000;"zz") zz = 13.29