Random variable
Download
Report
Transcript Random variable
CY1B2 Statistics
Aims: To introduce basic statistics.
Outcomes: To understand some fundamental concepts in
statistics, and be able to apply some probability distributions in
applications.
Statistics (5 lectures, 2 tutorials):
Probability distributions, discrete and continuous distributions,
Binomial distribution and Gaussian distributions and its
applications.
1
Statistics
•The probability theory and statistics is a mathematical
representation of random phenomena.
•Random variable
The outcome of a random phenomenon may take a numerical
value. When the outcomes of an event that produces random
results are numerical, the numbers obtained are called random
variables.
• Random variable has probabilities associated with the various
values of the variable.
• Discrete random variable has a countable number of possible
values.
2
Probability
• probability is always taken as a number lying between
0 and 1 and is denoted by p(x)
– p(x) = 1 means that an event is certain to happen
– p(x) = 0 means that an event is certain NOT to
happen
• so a toss of a coin could be represented as
– P(heads) = 0.5 and P(tails) = 0.5
• or, more formally
– p(x) = 0.5 x = heads, tails
3
Rules of probability
• there are some rules associated with probabilities when
the events are not dependent on each other
–
P(A or B) = P(A + B) = P(A) + P(B)
–
P(A and B) = P(AB) = P(A)P(B)
• for example, rolling a dice multiple times, or rolling
two dice
• if the events are not dependent but they are not
mutually exclusive then
–
P(A + B) = P(A) + P(B) - P(AB)
• how can this be extended to more than two possible
events?
4
•Discrete probability distributions
(i) Binomial distribution
1.
2.
3.
4.
An experiment which follows a binomial distribution will
satisf the following requirements (think of repeatedly flipping
a coin as you read these):
The experiment consists of n identical trials, where n is fixed
in advance.
Each trial has two possible outcomes, S or F, which we
denote ``success'' and ``failure'' and code as 1 and 0,
respectively.
The trials are independent, so the outcome of one trial has no
effect on the outcome of another.
The probability of success, p, is constant from one trial to
another.
5
(i) Binomial distribution
The probability in a process with two outcomes;
p for one outcome (e. g. success), q for another
(e. g. failure) (q=1-p)
The probability of r successes in n trials is given by the
(r+1)th term of the binomial expansion of ( q p )n
n!
r ( nr )
p( r )
p q
( n r )! r!
Where n! = 1 ×2×3×… ×n, factorial of n.
6
n!
( n r )! r!
is the count of choosing r from n.
The coefficients of polynomial expansion
(q p)
n=0;
n=1:
n=2;
n=3;
n=4;
n=5;
n
can be listed as a pyramid as
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
………………………
7
Example: Toss a coin 4 times, p =q=0.5, n=4. Find the
probabilities of throwing 0,1,2,3,4 heads.
( q p )4 q 4 4q 3 p 6q 2 p 2 4qp 3 p 4
r
p( r )
0
1
16
1
4
16
2
6
16
3
4
16
4
1
16
A plot of p(r) versus r is called
a probability distribution.
The Figure on the left is the
binomial probability distribution
for this example (p=q=0.5)
(Symmetrical)
8
Example: Toss a dice 4 times,
0,1,2,3,4 sixs. (p=1/6, q=5/6)
Find the probabilities of throwing
( q p ) q 4q p 6q p 4qp p
r
0
1
2
3
4
p( r )
0.4823 0.3858
0.1157
0.0154
0.0008
4
4
3
2
2
3
4
The Figure on the left
is the binomial
probability distribution
for this example
(p=1/6, q= 5/6)
(not symmetrical)
9
The mean value
(average number of successes)
r rp( r ) np
The mean square value
r2
can be shown to be
r 2 r 2 p( r ) ( np )2 nqp
The variance 2 is a measure of the deviation from the
mean, or the width of the distribution
2 ( r r )2 p( r ) nqp
can be shown to be ( r 2 r 2 )
10
The square root of the variance ,σ, in known as the standard deviation.
Example: Random sample of 900 people are asked “ have you
heard of Cybernetics’’. Find mean, mean square and variance
of the expected distribution, assuming that over the whole
population, 1/3 would say “yes’’. 2/3 would say “no”.
1
r np 900 300.
3
1 2
1 2
r n p npq 900 ( ) 900
3
3 3
90200
1 2
2
npq 900 200
3 3
200 14
2
2
2
2
11