Contents

History

PyQRS is the successor of the program PQRS (Probabilities, Quantiles and Random Samples).

PQRS was developed in the 1990's as a tool for calculating probabilities and quantiles associated with a number of probability distributions. It was meant as a replacement for printed tables for students who used computer aided instruction in statistics. PQRS also allowed you to draw random samples from included distributions.

PQRS was written in the programming language Pascal (later Delphi) and running under Windows.

In 2013 PQRS was rewritten in the scripting language Python and is now available for all common platforms. As a tribute to Python and its author, Guido van Rossum, the first letter in its name was replaced by 'Py'. Programming in Python is really a delight, due to its flexibility, well readable code (also by humans) and its richness of built-in structures. Because of the availability of the Scipy and Numpy modules, there was little left to program. The scipy.stats.distributions module already contains code for probability density functions, probability mass functions, cumulative distribution functions, moments and random samples for all but a few distributions in PyQRS. Only the distributions of the Wilcoxon signed rank-, Mann-Whitney- and Wilcoxon rank sum test statistics had to be coded by myself. Most coding time was spent on the user interface.

In 2016 a version for mobile devices (until now only for Android) appeared. It was again written in Python, with the Kivy framework. Unfortunately this time the Scipy package could not be used. Therefore the distribution specific functions (cdf, pdf, probability mass function, mean, variance) were also written in Python. The source code for a previous PQRS program could be easily transformed from Delphi to Python.

top

Differences between PyQRS and PQRS

The design and functionality of PyQRS is similar to PQRS. There are a few differences, though:

top

Detailed help

Select a distribution

In PyQRS probability distributions are characterised by their name and the values of their parameters. After startup the standard normal distribution is automatically selected. You can select another distribution from the combibox at the left. The parameter names are given below the distribution name. You can enter their values in the corresponding edits and press 'Enter'. Simple (Python) arithmetical expressions are allowed, e.g. 1/3, (4+5)*6/7, 2**(0.5), but for security reasons functions which contain letters, e.g. sqrt(2), e**2 or log(2), are not allowed. Possible restrictions for the parameter values are given in hints when you hover the mouse over an edit line (PyQRS 3) or when the edit field is empty and does not have the focus (PyQRS 4).

top

Find probabilities

After specifying the parameter(s) the graph of the probability density function (in the case of a continuous distribution) or the graph of the probability mass function (in the case of a discrete distribution) is shown under the 'pdf' or the 'pmf' tab respectively. If you want to find probabilities associated with a certain value x, you enter this x-value in the central edit (below the graph, with a white background), and press 'Enter'. You will find the left probability P(X < x) in the edit with pink background, the right probability P(X > x) in the edit with the light blue background and the probability P(X = x) in the edit with white background, the latter only if this probability is non-zero. In PyQRS4 these values are shown on top of the graph. In PyQRS 4 you have the option to define two cut-off points instead of one: tap on the '=' button in the lower left corner. That makes it possible to directly read the probability between two values you specify. There are two sliders, one for each cut-off point.

The graph of the cumulative probability function is shown under the 'cdf' tab. Here you will find the same x-value below the horizontal axis and the (cumulative) probability P(Xx) to the left of the vertical axis.

It is also possible to set a new x-value by clicking the left mouse button on a point on the graph with the desired x-coordinate (PyQRS 3) or on the slider below the graph (PyQRS 4) or moving this slider. .

top

Find an x-value (quantile)

The opposite of finding a probability, given an x-value, is finding an x-value, given a probability. The x-value associated with a certain cumulative probability is also called a quantile.

You can specify a left, right (under the 'pdf' or 'pmf' tab) or cumulative probability (under the 'cdf' tab), press 'Enter. Then the associated x-value is shown in the x-value edit field below the horizontal axis.

top

Change the number of decimals

The number of significant digits displayed in the x-value edit and in probability edits is automatically set by the program: probabilities with 3 significant digits and the x-value with a number of digits based on the dispersion of the distribution. You can change the number of significant digits through the menu (Viewo in PyQRS 3)) or by clicking the right mouse button on the x-value edit or on a probability edit (PyQRS 3) or after clicking/tapping on the 'Options' tab (PyQRS 4).

top

Find a missing parameter value

(PyQRS 3 and 4 only)

Usually we first specify a probability distribution (its name and all its parameter values) and then PyQRS calculates probabilities associated with a given x-value or the x-value (quantile), given a probability.

In PyQRS 3 and 4 it is also possible to find an unknown parameter value, given the distribution name, given the remaining parameter value(s), given the x-value and given one of the (left-, right or cumulative) probabilities. The method is a heuristic, not necessarily leading to a solution and if a solution is found, it may not be the only possible solution. But it will work in most cases.

The procedure is as follows:

  1. Specify the distribution (name).
  2. Select the 'pdf'/'pmf'-tab or the 'cdf'-tab and specify the x-value and a probability and all known parameter value(s), leaving only one parameter edit field blank.
  3. Hit 'Enter' and if the unknown parameter is real-valued (not integer valued), PyQRS will try to fit this missing parameter value.

top

Draw a random sample

If the distribution name and all parameter values are given, you may draw a (pseudo-)random sample from this distribution by selecting from the menu 'Sample' and 'Draw a random sample' (PyQRS 3). An alternative is selecting the 'sample' tab (PyQRS 3 and 4). Specify the sample size in the left column and hit 'Enter' and the resulting values are displayed.

The values may be saved to a file (PyQRS 3) or, after selecting (Ctrl-A) copied to the clipboard (Ctrl-V).

top

Save a graph or a sample

(PyQRS 3 only)

The currently shown graph (pdf, pmf or cdf) is saved to a file by selecting 'File', 'Save' from the menu or just by right clicking on the graph.

The contents of the 'sample' tab or the 'assign' tab is saved to a file also by selecting 'File', 'Save' from the menu.

If you want to save an image, you can take a screenshot by using appropriate software (PyQRS 4)

top

Display information about a distribution

Extensive information about distributions is provided by Wikipedia. If you have a working internet connection, the relevant Wikipedia page is shown in your browser if you press the 'Show Wikipedia page'.

top

Display help

This help is displayed selecting 'Help', 'Help' from the menu or just by selecting the 'help' tab (PyQRS 3) or by pressing the button at the bottom at the left hand side (PyQRS 4).

top