e-gloing

Saturday, December 7, 2013

random variables and probability distribution

Random variables and probability distributions

Random Variable
Expected Value
Variance
Probability Distribution
Cumulative Distribution Function
Probability Density Function
Discrete Random Variable
Continuous Random Variable
Independent Random Variables
Probability-Probability (PP) Plot
Quantile-Quantile (QQ) Plot
Normal Distribution
Poisson Distribution
Binomial Distribution
Geometric Distribution
Uniform Distribution
Central Limit Theorem

Main Contents page | Index of all entries


Random Variable The outcome of an experiment need not be a number, for example, the outcome when a coin is tossed can be 'heads' or 'tails'. However, we often want to represent outcomes as numbers. A random variable is a function that associates a unique numerical value with every outcome of an experiment. The value of the random variable will vary from trial to trial as the experiment is repeated.
There are two types of random variable - discrete and continuous.
A random variable has either an associated probability distribution (discrete random variable) or probability density function (continuous random variable).
Examples
  1. A coin is tossed ten times. The random variable X is the number of tails that are noted. X can only take the values 0, 1, ..., 10, so X is a discrete random variable.
  2. A light bulb is burned until it burns out. The random variable Y is its lifetime in hours. Y can take any positive real value, so Y is a continuous random variable.


Expected Value The expected value (or population mean) of a random variable indicates its average or central value. It is a useful summary value (a number) of the variable's distribution.
Stating the expected value gives a general impression of the behaviour of some random variable without giving full details of its probability distribution (if it is discrete) or its probability density function (if it is continuous).
Two random variables with the same expected value can have very different distributions. There are other useful descriptive measures which affect the shape of the distribution, for example variance.
The expected value of a random variable X is symbolised by E(X) or µ.
If X is a discrete random variable with possible values x1, x2, x3, ..., xn, and p(xi) denotes P(X = xi), then the expected value of X is defined by:
sum of xi.p(xi)
where the elements are summed over all values of the random variable X.
If X is a continuous random variable with probability density function f(x), then the expected value of X is defined by:
integral of xf(x)dx
Example
Discrete case : When a die is thrown, each of the possible faces 1, 2, 3, 4, 5, 6 (the xi's) has a probability of 1/6 (the p(xi)'s) of showing. The expected value of the face showing is therefore:
µ = E(X) = (1 x 1/6) + (2 x 1/6) + (3 x 1/6) + (4 x 1/6) + (5 x 1/6) + (6 x 1/6) = 3.5
Notice that, in this case, E(X) is 3.5, which is not a possible value of X.
See also sample mean.


Variance The (population) variance of a random variable is a non-negative number which gives an idea of how widely spread the values of the random variable are likely to be; the larger the variance, the more scattered the observations on average.
Stating the variance gives an impression of how closely concentrated round the expected value the distribution is; it is a measure of the 'spread' of a distribution about its average value.
Variance is symbolised by V(X) or Var(X) or sigma^2
The variance of the random variable X is defined to be:
V(X)=E(X^2)-E(X)^2
where E(X) is the expected value of the random variable X.
Notes
  1. the larger the variance, the further that individual values of the random variable (observations) tend to be from the mean, on average;
  2. the smaller the variance, the closer that individual values of the random variable (observations) tend to be to the mean, on average;
  3. taking the square root of the variance gives the standard deviation, i.e.:
    sqrt(V(X))=sigma
  4. the variance and standard deviation of a random variable are always non-negative.
See also sample variance.


Probability Distribution The probability distribution of a discrete random variable is a list of probabilities associated with each of its possible values. It is also sometimes called the probability function or the probability mass function.
More formally, the probability distribution of a discrete random variable X is a function which gives the probability p(xi) that the random variable equals xi, for each value xi:
p(xi) = P(X=xi)
It satisfies the following conditions:
  1. 0 <= p(xi) <= 1
  2. sum of all p(xi) is 1


Cumulative Distribution Function All random variables (discrete and continuous) have a cumulative distribution function. It is a function giving the probability that the random variable X is less than or equal to x, for every value x.
Formally, the cumulative distribution function F(x) is defined to be:
F(x) = P(X<=x)
for
-infinity < x < infinity
For a discrete random variable, the cumulative distribution function is found by summing up the probabilities as in the example below.
For a continuous random variable, the cumulative distribution function is the integral of its probability density function.
Example
Discrete case : Suppose a random variable X has the following probability distribution p(xi):
xi 0 1 2 3 4 5
p(xi) 1/32 5/32 10/32 10/32 5/32 1/32
This is actually a binomial distribution: Bi(5, 0.5) or B(5, 0.5). The cumulative distribution function F(x) is then:
xi 0 1 2 3 4 5
F(xi) 1/32 6/32 16/32 26/32 31/32 32/32
F(x) does not change at intermediate values. For example:
F(1.3) = F(1) = 6/32
F(2.86) = F(2) = 16/32


Probability Density Function The probability density function of a continuous random variable is a function which can be integrated to obtain the probability that the random variable takes a value in a given interval.
More formally, the probability density function, f(x), of a continuous random variable X is the derivative of the cumulative distribution function F(x):
f(x) = d/dx F(x)
Since F(x) = P(X<=x) it follows that:
integral of f(x)dx = F(b)-F(a) = P(a<X<b)
If f(x) is a probability density function then it must obey two conditions:
  1. that the total probability for all possible values of the continuous random variable X is 1:
    integral of f(x)dx = 1
  2. that the probability density function can never be negative: f(x) > 0 for all x.


Discrete Random Variable A discrete random variable is one which may take on only a countable number of distinct values such as 0, 1, 2, 3, 4, ... Discrete random variables are usually (but not necessarily) counts. If a random variable can take only a finite number of distinct values, then it must be discrete. Examples of discrete random variables include the number of children in a family, the Friday night attendance at a cinema, the number of patients in a doctor's surgery, the number of defective light bulbs in a box of ten.
Compare continuous random variable.


Continuous Random Variable A continuous random variable is one which takes an infinite number of possible values. Continuous random variables are usually measurements. Examples include height, weight, the amount of sugar in an orange, the time required to run a mile.
Compare discrete random variable.


Independent Random Variables Two random variables X and Y say, are said to be independent if and only if the value of X has no influence on the value of Y and vice versa.
The cumulative distribution functions of two independent random variables X and Y are related by
F(x,y) = G(x).H(y)
where
G(x) and H(y) are the marginal distribution functions of X and Y for all pairs (x,y).
Knowledge of the value of X does not effect the probability distribution of Y and vice versa. Thus there is no relationship between the values of independent random variables.
For continuous independent random variables, their probability density functions are related by
f(x,y) = g(x).h(y)
where
g(x) and h(y) are the marginal density functions of the random variables X and Y respectively, for all pairs (x,y).
For discrete independent random variables, their probabilities are related by
P(X = xi ; Y = yj) = P(X = xi).P(Y=yj)
for each pair (xi,yj).


Probability-Probability (P-P) Plot A probability-probability (P-P) plot is used to see if a given set of data follows some specified distribution. It should be approximately linear if the specified distribution is the correct model.
The probability-probability (P-P) plot is constructed using the theoretical cumulative distribution function, F(x), of the specified model. The values in the sample of data, in order from smallest to largest, are denoted x(1), x(2), ..., x(n). For i = 1, 2, ....., n, F(x(i)) is plotted against (i-0.5)/n.
Compare quantile-quantile (Q-Q) plot.


Quantile-Quantile (QQ) Plot A quantile-quantile (Q-Q) plot is used to see if a given set of data follows some specified distribution. It should be approximately linear if the specified distribution is the correct model.
The quantile-quantile (Q-Q) plot is constructed using the theoretical cumulative distribution function, F(x), of the specified model. The values in the sample of data, in order from smallest to largest, are denoted x(1), x(2), ..., x(n). For i = 1, 2, ....., n, x(i) is plotted against F-1((i-0.5)/n).
Compare probability-probability (P-P) plot.


Normal Distribution Normal distributions model (some) continuous random variables. Strictly, a Normal random variable should be capable of assuming any value on the real line, though this requirement is often waived in practice. For example, height at a given age for a given gender in a given racial group is adequately described by a Normal random variable even though heights must be positive.
A continuous random variable X, taking all real values in the range minus infinity to infinity is said to follow a Normal distribution with parameters µ and if it has probability density function
f(x) = {1/sqrt(2.pi.sigma^2)}.exp[-.5{(x-mu)/sigma}^2]
We write
X ~ N(mu, sigma^2)
This probability density function (p.d.f.) is a symmetrical, bell-shaped curve, centred at its expected value µ. The variance is sigma^2.
Many distributions arising in practice can be approximated by a Normal distribution. Other random variables may be transformed to normality.
The simplest case of the normal distribution, known as the Standard Normal Distribution, has expected value zero and variance one. This is written as N(0,1).
Examples

N(0,1) pdf N(2,1) pdf N(0,2) pdf


Poisson Distribution Poisson distributions model (some) discrete random variables. Typically, a Poisson random variable is a count of the number of events that occur in a certain time interval or spatial area. For example, the number of cars passing a fixed point in a 5 minute interval, or the number of calls received by a switchboard during a given period of time.
A discrete random variable X is said to follow a Poisson distribution with parameter m, written X ~ Po(m), if it has probability distribution
P(X=x) = (m^x/x!).e^(-m)
where
x = 0, 1, 2, ..., n
m > 0.
The following requirements must be met:
  1. the length of the observation period is fixed in advance;
  2. the events occur at a constant average rate;
  3. the number of events occurring in disjoint intervals are statistically independent.
The Poisson distribution has expected value E(X) = m and variance V(X) = m; i.e. E(X) = V(X) = m.
The Poisson distribution can sometimes be used to approximate the Binomial distribution with parameters n and p. When the number of observations n is large, and the success probability p is small, the Bi(n,p) distribution approaches the Poisson distribution with the parameter given by m = np. This is useful since the computations involved in calculating binomial probabilities are greatly reduced.
Examples

Po(3) pdf Po(5) pdf


Binomial Distribution Binomial distributions model (some) discrete random variables.
Typically, a binomial random variable is the number of successes in a series of trials, for example, the number of 'heads' occurring when a coin is tossed 50 times.
A discrete random variable X is said to follow a Binomial distribution with parameters n and p, written X ~ Bi(n,p) or X ~ B(n,p), if it has probability distribution
P(X=x) = (n choose x).p^x.(1-p)^n-x
where
x = 0, 1, 2, ......., n
n = 1, 2, 3, .......
p = success probability; 0 < p < 1
(n choose x) = n! / {x!(n-x)!}
The trials must meet the following requirements:
  1. the total number of trials is fixed in advance;
  2. there are just two outcomes of each trial; success and failure;
  3. the outcomes of all the trials are statistically independent;
  4. all the trials have the same probability of success.
The Binomial distribution has expected value E(X) = np and variance V(X) = np(1-p).
Examples

Bi(10,0.5) pdf Bi(10,0.25) pdf


Geometric Distribution Geometric distributions model (some) discrete random variables. Typically, a Geometric random variable is the number of trials required to obtain the first failure, for example, the number of tosses of a coin untill the first 'tail' is obtained, or a process where components from a production line are tested, in turn, until the first defective item is found.
A discrete random variable X is said to follow a Geometric distribution with parameter p, written X ~ Ge(p), if it has probability distribution
P(X=x) = px-1(1-p)x
where
x = 1, 2, 3, ...
p = success probability; 0 < p < 1
The trials must meet the following requirements:
  1. the total number of trials is potentially infinite;
  2. there are just two outcomes of each trial; success and failure;
  3. the outcomes of all the trials are statistically independent;
  4. all the trials have the same probability of success.
The Geometric distribution has expected value E(X)= 1/(1-p) and variance V(X)=p/{(1-p)2}.
The Geometric distribution is related to the Binomial distribution in that both are based on independent trials in which the probability of success is constant and equal to p. However, a Geometric random variable is the number of trials until the first failure, whereas a Binomial random variable is the number of successes in n trials.
Examples

Ge(0.5) pdf Ge(0.75) pdf


Uniform Distribution Uniform distributions model (some) continuous random variables and (some) discrete random variables. The values of a uniform random variable are uniformly distributed over an interval. For example, if buses arrive at a given bus stop every 15 minutes, and you arrive at the bus stop at a random time, the time you wait for the next bus to arrive could be described by a uniform distribution over the interval from 0 to 15.
A discrete random variable X is said to follow a Uniform distribution with parameters a and b, written X ~ Un(a,b), if it has probability distribution
P(X=x) = 1/(b-a)
where
x = 1, 2, 3, ......., n.
A discrete uniform distribution has equal probability at each of its n values.
A continuous random variable X is said to follow a Uniform distribution with parameters a and b, written X ~ Un(a,b), if its probability density function is constant within a finite interval [a,b], and zero outside this interval (with a less than or equal to b).
The Uniform distribution has expected value E(X)=(a+b)/2 and variance {(b-a)2}/12.
Example

Un(10,20) pdf


Central Limit Theorem The Central Limit Theorem states that whenever a random sample of size n is taken from any distribution with mean µ and variance sigma^2, then the sample mean x_bar will be approximately normally distributed with mean µ and variance sigma^2/n. The larger the value of the sample size n, the better the approximation to the normal.
This is very useful when it comes to inference. For example, it allows us (if the sample size is fairly large) to use hypothesis tests which assume normality even if our data appear non-normal. This is because the tests use the sample mean x_bar, which the Central Limit Theorem tells us will be approximately normally distributed.



Top of page | Main Contents page

No comments:

Post a Comment