Using PyQRS


Using PyQRS


Select a distribution

Probability distributions are characterised by their name and the values of their parameters. You can select a distribution from the combibox below the heading 'Distribution'. A few distributions are defined with different parametrizations. They appear multiple times in the list, each time with a different parametrization. After startup the (standard) normal distribution with parameters (μ, σ²) = (0, 1) is automatically selected.
The parameter names are given below the distribution name. You can enter their values in the corresponding edits and press 'Enter'. Possible restrictions for parameter values are given in hints. Simple arithmetical expressions are allowed, e.g. 1/3, (4+5)*6/7, sqrt(2), 2^(0.5), e**2 or log(2).

PyQRS
Starting screen
PyQRS
Binomial distribution specified

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 'pmf' tab respectively. It is possible to move the division line between the red (left hand) and blue (right hand) part of the graph, by means of a finger (Android version) or by the slider below the graph (Linux and Windows version). Thereafter the \(x\)-axis is divided in two or three parts with red, white (or grey) and blue colours. The figure at the left below shows such a partition with probabilities \(P(X < -1.960) = 0.0250\), \(P(-1.960 < X < 1.645) = 0.9250\) and \(P(X > 1.645) = 0.0500\). In the figure at the right: \(P(X < 4) = 0.1071\), \(P(4 \leq X \leq 7) = 0.6652\) and \(P(X > 7) = 0.2277\).

Standard normal density function
Standard normal probability density function
Binomial probability function
Binomial probability function

More accurate than moving the slider is entering the \(x\)-value in one of the two edit fields below the \(x\)-axis and pressing 'Enter'.

The graph of the cumulative probability function is shown under the 'cdf' tab. You will find the \(x\)-value below the horizontal axis and the corresponding (cumulative) probability \(P(X ≤ x)\) to the left of the vertical axis. In the figure below left: \(P(X ≤ 1.000) = 0.8413\) and in the figure at the right: \(P(X <= 7) = 0.7723\).

Standard normal cumulative distribution function
Standard normal cumulative distribution function
Binomial cumulative distribution function
Binomial cumulative distribution function

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) and press 'Enter. Then the associated \(x\)-value is shown in the edit field below the horizontal axis.


Fit a missing parameter value

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 the cumulative probability. 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. Specify all known parameters by entering their value(s), each time finishing with hitting 'Enter'. Then only one parameter value will be left open. This unknown parameter should be real-valued, not integer-valued.
One parameter (p) left unspecified
Specify x-value (6)
  1. Specify the \(x\)-value and the cumulative probability. The latter value is specified not only if you enter it under the 'cdf'-tab, but also if you enter it in the red edit field under the 'pdf'/'pmf'-tab if the distribution is continuous. You may even specify the cumulative probability by entering its complement in the blue edit field under the 'pdf'/'pmf'-tab.
  2. After you specified the last value by hitting 'Enter', PyQRS will try to fit the missing parameter value and show it under the 'Specification'-tab.
Specify cumulative probability (0.2)
The missing parameter value is computed

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 the 'sample' tab. Specify the sample size, hit 'Enter' or click/tap on the 'Draw a random sample'-button and the sample values will be displayed as shown in the figure below. After selecting the values (Ctrl-A) they may be copied to the clipboard (Ctrl-C) and pasted into another application (Ctr-V).

Random sample from standard normal distribution
Random sample from a standard normal distribution
Random sample from binomial distribution
Random sample from a binomial(20, 0.3) distribution

Display Wikipedia information

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

Similarly, information about PyQRS is shown in your browser after clicking 'Show PyQRS page'.


Change the number of decimals

The numbers of significant digits displayed in the edit fields are automatically set by the program: probabilities with 4 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 on the Specification page.