Info, referenser, m.m...

Individual Y-scaling

NB: Individual Y-scaling

Probability density function (pdf)

Cumulating distribution function (cdf)

*μ*:

*σ*:

8. Several distributions in one diagram – an animation

Statistical distributions are usually specified by their numerical parameters. Sometimes it is difficult
to visualize the shape and spread of the distribution using only these values. In this exercise it is
possible to enter (*μ*) and theoretical standard deviation (*σ*) and see the corresponding
parameters of the distribution of interest.

General.
This animation makes it possible to draw several distributions in one diagram. All the distributions
have the same expected value (*μ*) and theoretical standard deviation (*σ*).

These two values are controlled by two slides and are also presented to the left on the screen.

The normal distribution is defined on the whole of the number line while the other three are only defined on
the positive scale, which is visible in the graphs.

The functions.
The three functions drawn, *the probability density function*, *the distribution function* and *the hazard function*
are all connected to one another. Knowing one of them makes it possible to mathematically derive the other ones.
Any good book about survival analysis shows the details in doing this.

Checkboxes.
There are a number of checkboxes that can be used to hide one or several of the drawn distributions. This
is handy when comparing just two distributions.

NB that when a distribution is hidden the scales of
the remaing ones are *not* recalculated unless the checkbox 'Individual Y-scaling' is ticked.

Buttons.
To the left there are a number of buttons with various information.

Another link.
The following link leads to our Swedish page where each distribution can be studied in more detail:

http://www.indstat.se/simuleringar/simuleringar.php

••••

*μ* (Expected value)

*σ* (standard deviation)

Show/hide the normal distribution

Show/hide the lognormal distribution

Show/hide the gamma distribution

Show/hide the Weibull distribution

•

NB: Individual Y-scaling

Exercise 1 – change the parameters

Change the parameters via the slides and note that the distributions change accordingly. If necessary, change the min or max values of the X-axis.

Note that the two parameters of each distribution also change. (For the normal distribution, the values of the two parameters correspond to the expected
value and the standard deviation.)

Note that all four distributions have the same expected value and standard deviation but different height. (The area under each probability density function is 1.)

Exercise 2 – mu and sigma equal to 1

Change the two slides making μ and σ equal to 1. Hide both the normal and the lognormal distributions. Change 'xmax' to 6 by clicking the current
value under the graph and enter 6.
Notice that the parameters för the gamma distribution and the Weibull have parameter values equal to 1. This is a special case of
the two distributions also known as *the exponential distribution*.

Click the [Hazard function]-button and see that the function is a straight horisontal line, i.e. the hazard does not change. (This is the
'no aging', 'no memory'-feature of the exponental distribution.)

Exercise 3 – a straight line hazard

Hide all but the Weibull distribution and tick the 'Individual..'. Change the two slides so that the left Weibull a-parameter is equal to 2.
This special case of the Weibull is called *the Rayleigh distribution*.
Open the [Hazard function] and notice that the function is a straight line when *a* = 2:

Exercise 4 – a nearly symmetrical Weibull

Hide all but the Weibull distribution and the normal distribution. Change the two slides so that the left Weibull parameter is equal to 3.6.
Notice that the two distributions coincide rather good. Click the [Hazard function]-button and notice that there is a visible difference
between the two functions.

Exercise 5 – the lognormal distribution

Hide all but the lognormal distribution and tick the 'Individual..'. Change the top slide to smaller values and note
that the hasard function has a peculiar form (in most life lengths and survival studies the hazard function is either decreasing or
increasing.)

More information

The link ovn.ing-stat.se/fordelningar/WeibSlid1.php leads
to 'Ett antal fördelningar' that discusses each distribution in more detail.

••••

The so-called *cumulative distribution function* is an increasing curve and the Y-axis has always the interval [0, 1]
and shows the probability of getting a value smaller than the stated X-value.

(The X-value that
corresponds to Y = 0.5 is called *the median*).

The X-axis can be changed by clicking and changing the min or max values for a better fit. This is done
in the pdf-diagram.

See also the link under the top 'Info'-button for more info about each distribution.

••••

Each curve is the so-called *probability density function* of a distribution. The area under each curve is 1,
the total probaility.

The expected value is indicated on the X-axis as one red vertical bar with the value attached to it.
The small red lines indicate 1, 2, and 3 sigma from the expected value.

The X-axis can be changed by clicking and changing the min or max values for a better fit. This will
also change the X-scale for the cdf-function.

See also the link under the top 'Info'-button for more info about each distribution.

••••

**Exercises.** A number of exercises to further illuminate certain features of the variables.

**Hazard function.** The hazard function is extremely important when the distributions are used in connection
to life length studies. Clicking the button shows the functions.

**Parameters.** It is possible to change the expected value and the standard deviation of the distributions. This is
done using the two slides.

**Individual Y-scaling.** When clicked, the probability density function and the hazard functions are scaled
individually in the window. This is useful when studying the features of a specific distribution. (NB when not clicked,
all four distributions, even any hidden one, are used in determine the Y-scaling.)

* μ.* The theoretical mean of the distributions.

••••

Usually the parameters of a distribution are entered to give its expected value (*μ*) and standard deviation (*σ*).
Inversely, here the slides can be used to vary the expected value and the standard deviation to see the corresponding distribution and its parameters.

(The range of the two slides can not be changed. The slides move 0.001 every time a right
or left arrow is pressed.)

** μ (Expected value)** The theoretical mean of all four distributions.

The four checkboxes can be used to show or hide a specific distribution.

NB that the distributions are initially drawn with common Y- and X-scales. Thus hiding one or several distributions will not change the scales of remaining ones. However, by using the checkbox to the left, individual scaling can be applied to the Y-axis.

Note that certain extreme values of the two slides give a numerical problem doing the calculations for the Weibull distribution. A large red dot indicates this and there are no further updates of any parameter. Also the scaling cannot be changed on the X-axes. By changing the slides, all are reset.

••••

The *hazard function* is an important function in connection to life length studies and survival analysis.
The function is defined in the following way:

With a good text book it is not too difficult to follow the derivation of the expression above.

The hazard function is the instantanous rate of failure (death) at time *x*. There is a vast amount
of information on the net and in text book describing the function, and other functions, dealing with
life length analysis.

See also the [Exercises] to the left.

••••