Usage

The user interface features four views/tabs at the right hand side with labels: specification, pdf/pmf, cdf and sample. Their functions are described in the first four sections below. In the fifth section the necessary steps to fit a missing parameter value are described. The last section contains a list of included distributions.

Specification tab

Under the first tab the following data may be specified:

  • the distribution name
  • its parameter values
  • the number of decimals for \(x\)-values
  • the number of decimals for probabilities.

Furthermore, if you have a working internet connection, the distribution’s Wikipedia page and this PyQRS usage page can be displayed in your browser.

Starting screen: standard normal distribution

Specified: binomial (20,0.3) distribution

Probability distributions are characterised by their name and the values of their parameters. A distribution is selected from the blue listbox below ‘Distribution’. A few distributions appear multiple times in the list, each time with a different parametrisation. After startup the standard normal distribution, with parameters \((μ, σ) = (0, 1)\), is automatically selected.

After editing the parameter values in the white edit fields, press ‘Enter’. 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).

Probability density/mass function tab

If the distribution and its parameter values have been specified, you will find a graph of the probability density function (for a continuous distribution) or the probability mass function (for a discrete distribution) under the second tab. You may edit the values in the edit fields below the \(x\)-axis and in the two coloured edit fields above the \(x\)-axis; after pressing ‘Enter’ the position and values of the edit fields are adapted to the new situation.

Standard normal probability density function

Binomial (20, 0.3) probability mass function

It is also possible to move the division lines between the red, white and blue part of the graph, by means of a finger (Android version) or by the slider below the graph (Linux and Windows versions).

Cumulative distribution function tab

If the distribution and its parameter values have been specified, you will find a graph of the cumulative distribution function under the third tab.

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 called a quantile.

Standard normal cumulative distribution function

Binomial (20,0.3) cumulative distribution function

You may edit the value in the quantile edit field below the \(x\)-axis and in the cumulative probability edit field along the \(y\)-axis; after pressing ‘Enter’ the position and values of both edit fields are adapted to the new situation.

It is also possible to move the vertical line by means of a finger (Android version) or by the slider below the graph (Linux and Windows versions).

Random samples tab

If the distribution name and its parameter values have been specified, you may draw a (pseudo-)random sample under the ‘sample’ tab.

Random sample of size 100 from a
standard normal distribution

Random sample of size 100 from a
binomial (20,0.3) distribution

Specify the sample size, hit ‘Enter’ or click/tap on the ‘Draw a random sample’-button and the sample values will be displayed. After selecting the values (Ctrl-A) they may be copied to the clipboard (Ctrl-C) and pasted into another application (Ctr-V).

The number of decimals in the sample values can be specified in the ‘for \(x\)-values’ field under the ‘specification’ tab.

Fit a parameter value

PyQRS can also be used to find an unknown parameter value, given the distribution name, given the remaining parameter value(s), given an \(x\)-value and given the cumulative probability at \(x\). 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.

Where it does not work

One example where the method does not work is the normal distribution with \(\mu\) known to be equal to \(x\); let’s assume both are \(0\). Then you will not find a solution for \(\sigma\) such that \(F(x) = p\) for \(p \neq 0.5\). And for any value of \(\sigma\) the equality \(F(x) = 0.5\) will hold. Similar examples exist for other symmetric distributions where a location parameter is fixed and a scale parameter is unknown.

To apply the fitting procedure:

  1. Under the specification tab specify the distribution (name),
  2. specify all known parameters by entering their value(s), finishing with pressing ‘Enter’. Then only one parameter value will be left open. This unknown parameter should be real-valued, not integer-valued.
  1. Under the cumulative distribution tab specify the \(x\)-value and the cumulative probability.
  2. Then, after pressing ‘Enter’, PyQRS will try to fit the missing parameter value and show it under the specification tab.
Note

In step 3 the cumulative probability can also be specified in the red edit field under the probability density/mass function tab if the distribution is continuous. You may even specify the cumulative probability by entering its complement in the blue edit field under the same tab.

Included distributions

Discrete Continuous Continuous
binomial normal (gaussian) inverse gaussian
Bernoulli t non-central t
hypergeometric chi-square non-central chi-square
discrete-uniform F non-central F
negative-binomial beta non-central beta
geometric gamma Cauchy
Poisson exponential Gumbel
Mann-Whitney double-exponential (Laplace) Pareto
Wilcoxon rank-sum logistic Weibull
Wilcoxon signed rank log-normal triangular
folded-normal uniform