Sunteți pe pagina 1din 45

Mathemetics For Scientists

Lecture Probability

Faculty of Science

Maldives National University

February 19, 2017

1 / 38
Random Variables

Definition
A random variable is a numerical measure of the outcome from a
probability experiment, so its value is determined by chance.
Random variables are denoted using letters such as X.

Definition
A discrete random variable is a random variable that has values
that has either a finite number of possible values or a countable
number of possible values.

Definition
A continuous random variable is a random variable that has an
infinite number of possible values that is not countable.

2 / 38
Examples

Determine whether the following random variables are discrete or


continuous. State possible values for the random variable.
1 The number of fish caught in a fishing tournment

3 / 38
Examples

Determine whether the following random variables are discrete or


continuous. State possible values for the random variable.
1 The number of fish caught in a fishing tournment
n = 0, 1, 2, 3 . . . discrete
2 The distance of a baseball travels in the air after being hit

3 / 38
Examples

Determine whether the following random variables are discrete or


continuous. State possible values for the random variable.
1 The number of fish caught in a fishing tournment
n = 0, 1, 2, 3 . . . discrete
2 The distance of a baseball travels in the air after being hit
d > 0 continuous
3 The length of time between calls to 911.

3 / 38
Examples

Determine whether the following random variables are discrete or


continuous. State possible values for the random variable.
1 The number of fish caught in a fishing tournment
n = 0, 1, 2, 3 . . . discrete
2 The distance of a baseball travels in the air after being hit
d > 0 continuous
3 The length of time between calls to 911. discrete
4 A single die is cast. The numbers showing on the die.

3 / 38
Examples

Determine whether the following random variables are discrete or


continuous. State possible values for the random variable.
1 The number of fish caught in a fishing tournment
n = 0, 1, 2, 3 . . . discrete
2 The distance of a baseball travels in the air after being hit
d > 0 continuous
3 The length of time between calls to 911. discrete
4 A single die is cast. The numbers showing on the die.discrete

3 / 38
Probability distribution

The probabilty distribution of a random variable X provides the


possible values of teh random variable and their corresponding
probability distribution can be in the form of a graph or a
mathematical formula

4 / 38
Discrete Probability Distributions

Definition
Rules for a discrete probability distribution
Let P(x) denote the probability that the random variable X equals
x; then
P
1 P(x) = 1
2 0 ≤ P(x) ≤ 1

5 / 38
examples
Determine whether the distribution is discrete probability
distribution.

Table
P (a) not a discrete distribution it does not meet
P(x) = 1
Table
P (b) is a discrete distribution It meets the condition
P(x) = 1
6 / 38
Probability Histogram

A probability Histogram is a histogram in which the horizontal axis


represents to the value of the random variable and the vertical axis
represents the probability of each value of the random variable.

7 / 38
Example

x P(x)
0 0.30
1 0.15
2 ?
3 0.20
4 0.15
5 0.05

What is the missing value

8 / 38
Example

x P(x)
0 0.30
1 0.15
2 ?
3 0.20
4 0.15
5 0.05

What is the missing value all the probabilities should add up to 1.


0.30 + 0.15 + x + 0.20 + 0.15 + 0.05 = 1 ∴ x = 0.15

8 / 38
Histograms

9 / 38
Mean and Standard deviation

Definition
The mean of a Discrete Randomvariable is given by the formula
X
µx = [x · P(x)]

where x is the value of the random variable and P(x) is the


probability of observing the value x.

10 / 38
Variance and standard deviation

Definition
The variance of a discrete random variable is given by
X
σx2 = [(x − µx )2 · P(x)] (1)
X
= [x 2 · P(x)] − µ2 x (2)
where x is the value of the random variable µx is the mean of the
random variable, and P(x) is the probability of observing the
random variable x.

11 / 38
Standard deviation

Definition
p
Standard deviation is the quare root of the variance σx2

12 / 38
example

Example
Find the mean, variance, and standard deviation of the discrete
random variable x.
0 0.073 0 ∗ (0.73) = 0
1 0.117 1 ∗ (0.117) = 0.117
2 0.258 2 ∗ (0.258) = 0.516
3 0.322 3 ∗ (0.322) = 0.966
4 0.230 4 ∗ (0.230 = 0.920
P
µx = [x · P(x)] = 2.5189

13 / 38
How to do this using software package R

1 Open R
2 x < −c(0, 1, 2, 3, 4)
3 f < −c(0.075, 0.117, 0.258, 0.322, 0.230)
4 mu < −sum(x ∗ f )
5 mu

14 / 38
Expected Value

Definition
The expected value of a discrete random variable X is defined as
m
X
E (X ) ≡ hX i = pi xi .
i=1

This is also sometimes called the mean of the random variable X


and denoted as µ.

15 / 38
Expected Value Example

If the table below represents the PDF of random variable X, find


E(X)

X -1 3 5
P(X) 0.3 0.2 0.5

E (X ) = (−1)(0.3) + (3)(0.2) + (5)(0.5)


E (X ) = −0.3 + 0.6 + 2.5
E (X ) = 2.8

16 / 38
Expected value R code

x<-c(-1,3,5)
> f<-c(0.3,0.2,0.5)
> ex<-sum(f*x)
> ex
[1] 2.8
>

17 / 38
Binomial distribution

Definition
An experiment is said to be a binomial experiment if
1 If the experiment is performed a fixed number of times. Each
repetition is called a trial.
2 The trials are independent. This means the outcome of one
trial will not effect the outcome of the other trials.
3 For each trial, there are two mutually exclusive outcomes:
success or failure.
4 The probability of success is the same for each trial of the
experiment

18 / 38
examples

State whether the following are binomial distributions


1 A random sample of 30 cars in a used car lot is obtained, and
their mileages recorded.

19 / 38
examples

State whether the following are binomial distributions


1 A random sample of 30 cars in a used car lot is obtained, and
their mileages recorded.not a binomial distribution as the
milages can have more than two outcomes
2 A poll of 1,200 registered voters is conducted in which the
repondents are asked whether they believe Congress should
reform Social Security.

19 / 38
examples

State whether the following are binomial distributions


1 A random sample of 30 cars in a used car lot is obtained, and
their mileages recorded.not a binomial distribution as the
milages can have more than two outcomes
2 A poll of 1,200 registered voters is conducted in which the
repondents are asked whether they believe Congress should
reform Social Security.binomial distribution; there are two
outcomes, fixed number of trials, trials are independent.

19 / 38
Notations used

There are n independent trials for the experiment


Let p denote the probability of success so that 1 − p is the
probability of failure.
Let x denote the number of successes in n independent
experiments So 0 ≤ x ≤ n

20 / 38
Binomial Probability Distribution Function

The probability of obtaining x successes in n independent trials of a


binomial experiment where the probability of success p is given by
 
N x
P(X = x) = p (1 − p)n−x
K

x = 0, 1, . . . n
where p is the probability of success

21 / 38
example
Hockey cards, chosen at random from a set of 20, are given away
inside cereal boxes. Stan needs one more card to complete his set
so he buys five boxes of cereal. What is the probability that he will
complete his set?
1 Number of trials n= 5
2 number of success x=1
1 1
3 Probability of success = ,p =
20 20
19 19
4 Probability of failure = ,q =
20 20
Probability of success =
 
5 1 19
× ( )1 × ( )4 = 0.20
1 20 20

22 / 38
example

seven coins are tossed. What is the probability of four tails and 3
heads.
1 number of trials n = 7
2 Number of success x = 4
1
3 probability of success p =
2
1
4 probability of failure p =
  2
7 1 4 1
× ( ) × ( )3 = 0.273
4 2 2

23 / 38
example

A true or false test 12 questions. Suppose you guess all 12. What
is the probability of exactly seven correct answers
1 n = 12
2 number of successn = 7
1
3 probability of success =
2
1
4 probability of failure =
2
 
12 1 1
× ( )7 × ( )5 = 0.0.193
7 2 2

24 / 38
example

A test consists of 10 multiple choice questions, each with four


possible answers. To pass the test, one must answer at least nine
questions correctly. Find the probability of passing, if one were to
guess the answer for each question.
1 n = number of trialsn = 10
2 number of success x = 9
1
3 probability of success p =
4
3
4 probability of failure q =
    4    
10 1 9  3 1 10 1 10  3 0
× × = 0.0000296 + × ×
9 4 4 10 4 4

25 / 38
Example
A family has nine children. What is the probability that there is at
least one girl?
1 trials n = 9
2 success x = 0
1
3 probability of success p =
2
1
4 probability of failure q =
2
Probability of zero girls =
   
9 1 0  1 9
× × = 0.00195
0 2 2
The probability of atleast one girl = 1− probability of zero girls

1 − 0.00195 = 0.998
26 / 38
Normal Distribution

The normal distribution is defined by the density function

x − µ2
1 −
f (x) = √ e 2σ
σ 2π
The function happends to be symmetrical, and bell shaped

27 / 38
Normal distribution examples

28 / 38
Create a normal curve using R

# Create a sequence of numbers between -10 and 10 increment


x <- seq(-10, 10, by = .1)

# Choose the mean as 2.5 and standard deviation as 0.5.


y <- dnorm(x, mean = 2.5, sd = 0.5)

# Give the chart file a name.


png(file = "dnorm.png")

plot(x,y)

# Save the file.


dev.off()

29 / 38
Normal Curve

30 / 38
Creating a Normal Distribution Curve

Our first sketch is known as the Standard Normal Distribution. We


first create a sequence of 200 numbers, beginning at x = 3 and
ending at x =3

x<-seq(-3,3,length=200)
> y = dnorm(x,mean=0,sd=1)
> plot(x,y)

31 / 38
Normal distribution

32 / 38
Normal plot
if we want to connect the plots use
plot(x,y,type="l")

33 / 38
Finding the area under the normal curve

x=seq(-3,3,length=200)
y=dnorm(x,mean=0,sd=1)
plot(x,y,type="l")
x=seq(-3,0,length=100)
y=dnorm(x,mean=0,sd=1)
polygon(c(-3,x,0),c(0,y,0),col="red")

34 / 38
Normal Curves

35 / 38
Finding the area under the normal curve

pnorm(1,mean=0,sd=1)
[1] 0.8413447

36 / 38
z score

What is a Z score
A measure of an observations distance from the mean.
The distance is measured in standard deviation units.
If a z-score is zero, its on the mean.
If a z-score is positive, its above the mean.
If a z-score is negative, its below the mean.
If a z-score is 1, its 1 SD above the mean.
If a z-score is −2, its 2 SDs below the mean

37 / 38
Computing a z score

Definition

X −µ
z=
σ
OR

X −X
z=
SD

38 / 38

S-ar putea să vă placă și