# Documents

Rationale

The uncertainties of the sensitivity, specificity and prevalence may make diagnostic test under uncertainty. Especially when distribution of uncertainty is asymmetrical, calculation for long-term test validity will be difficult. Both DiagRisk for Windows (GPU based Monte Carlo simulation console application) and DiagRisk for Android are used for finding diagnostic long-term test validity under uncertainty by using native processing.

Decision tree in diagnostic test simulation

Speed Tests on Windows

When using DiagRisk to simulate from 10 millions to 50 millions of iterations on both CPU and GPU, the results of time use are as follow:

How to use DiagRisk console app on Windows

DiagRisk is x64 console application that can run only on Microsoft Windows x64. To use GPU processing power, you need CUDA-enabled GPU with driver installed on your computer.

Before using DiagRisk, you have to estimate the distributions of sensitivity, specificity and prevalence. DiagRisk supports only normal distribution and uniform distribution for these estimations. You also have to specify how many iteration you'll use in this simulation. The higher is better but the limitation will depend on GPU memory and Timeout Detection and Recovery (TDR) of Windows. For example:

DiagRisk -prev u0.03,0.04 -sens t0.93,0.99,0.97 -spec n0.75,0.015 -n 1000000 -show -gpu

This command will run DiagRisk with disease prevalence min = 0.03 and max = 0.04 in uniform distribution (-prev u0.03,0.04), sensitivity with triangular distribution min = 0.93 max = 0.99 and most likely = 0.97 (-sens t0.93,0.99,0.87) and specificity with normal distribution mean = 0.75 and SD = 0.015 ( -spec n0.75,0.015). "u", "t" and "n" stand for uniform, triangular and normal distribution respectively. This simulation will iterate 1,000,000 times (-n 1000000) and show output on the screen (-show). DiagRisk will also use GPU computing (-gpu). If you don't type "-gpu", it will use only CPU for computing.

The output is as follow:

DiagRisk v2.1.1

Freeware developed by Poom Malakul Na Ayudhya

DiagRisk -prev u0.03,0.04 -sens t0.93,0.99,0.97 -spec n0.75,0.015 -n 1000000 -show -gpu

Using Device 0: GeForce GT 650M

Time used: 0.0827344 sec

**** OUTPUT ****

N: 1000000

True Positive: 33465 (3.3465%)

False Negative: 1261 (0.1261%)

False Positive: 240942 (24.0942%)

True Negative: 724332 (72.4332%)

Sensitivity: 96.3687%

Specificity: 75.039%

Positive Predictive Value: 12.1954%

Negative Predictive Value: 99.8262%

Accuracy: 75.7797%

In case you want to export raw data for further investigations, you can type "-export" in the command line. This will create 6 text files: dise.txt, test.txt, sens.txt, spec.txt, prev.txt and result.txt ( disease random number, test random number, sensitivity, specificity, prevalence and result). Beware that when simulation size (-n) is very big, it will take very long time and create very huge files.

How to use DiagRisk for Android

DiagRisk for Android supports only for Anroid Version 5 or later. If your device is multi-core, the app will run faster as many core your device has. It use native concurrency execution to make it fast as possible. The concept of using is the same as Windows console app but using the graphical user interace for input and output.