2005 geog090 discrete
TRANSCRIPT
-
7/23/2019 2005 GEOG090 Discrete
1/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
Probability Some Definitions
Probability Refers to the likelihood that something
(an event) will have a certain outcome
An Event Any phenomenon you can observe that canhave more than one outcome (e.g. flipping a coin)
An Outcome Any unique condition that can be the
result of an event (e.g. the available outcomes when
flipping a coin are heads and tails), a.k.a. simple events
or sample points Sample Space The set of all possible outcomes
associated with an event (e.g. the sample space for
flipping a coin includes heads and tails)
-
7/23/2019 2005 GEOG090 Discrete
2/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
For example, suppose we have a data set where in six
cities, we count the number of malls located in that city
present:City # of Malls
1 1
2 4
3 4
4 45 2
6 3
We might wonder if we randomly pick one of these sixcities, what is the chance that it will have n malls?
Probability An Example
Outcome #1
Outcome #2
Outcome #3
Outcome #4
Sample
Space
Each
count of
the # of
malls in
a city is
an event
-
7/23/2019 2005 GEOG090 Discrete
3/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
What we have here is a random variable
defined as variable X whose range of values xiare
sampled randomly from a population
To put this another way, a random variable is a
function defined on the sample space thismeans that we are interested in all the possible
outcomes The question was: If we randomly pick one of
the six cities, what is the chance that it will have
n malls?
Random Variables and
Probability Functions
-
7/23/2019 2005 GEOG090 Discrete
4/35David Tenenbaum GEOG 090 UNC-CH Spring 2005
To answer this question, we need to form a
probability function (a.k.a. probability
distribution) from the sample space that gives allvalues of a random variable and their probabilities
A probability distribution expresses the relativenumber of times we expect a random variable to
assume each and every possible value
We either base a probability function on either a
very large empirically-gathered set of outcomes,
or else we determine the shape of a probabilityfunction mathematically
Random Variables and
Probability Functions
-
7/23/2019 2005 GEOG090 Discrete
5/35David Tenenbaum GEOG 090 UNC-CH Spring 2005
Here, the values of xiare drawn from the four outcomes,
and their probabilities are the number of events with each
outcome divided by the total number of events:City # of Malls
1 1
2 4
3 4
4 45 2
6 3
Probability An Example, Part II
Outcome #1
Outcome #2
Outcome #3
Outcome #4
xi P(x
i)
1 1/6 = 0.167
2 1/6 = 0.167
3 1/6 = 0.1674 3/6 = 0.5
The probability of an outcome P(xi) =
# of times an outcome occurred
Total number of events
-
7/23/2019 2005 GEOG090 Discrete
6/35David Tenenbaum GEOG 090 UNC-CH Spring 2005
We can plot this probability distribution as a probability
mass function:
Probability An Example, Part III
xi P(x
i)
1 1/6 = 0.167
2 1/6 = 0.1673 1/6 = 0.167
4 3/6 = 0.50
0.25
0.50
P(x
i)
1 2 3 4
xi
This plot uses thin lines to denote that the probabilities aremassed at discrete values of this random variable
-
7/23/2019 2005 GEOG090 Discrete
7/35David Tenenbaum GEOG 090 UNC-CH Spring 2005
The random variable from our example is a
discrete random variable, because it has a finite
number of values (i.e. a city can have 1 or 2malls, but it cannot have 1.5 malls)
Any variable that is generated by counting awhole number of things is likely to be a discrete
variable (e.g. # of coin tosses in a row with heads,
questionnaire responses where one of a set ofordinal categories must be chosen, etc.)
A discrete random variable can be described by aprobability mass function
Discrete Random Variables
-
7/23/2019 2005 GEOG090 Discrete
8/35David Tenenbaum GEOG 090 UNC-CH Spring 2005
Probability mass functions have the following
rules that dictate their possible values:
1. The probability of any outcome must be greaterthan or equal to zero and must also be less than or
equal to one, i.e.0 P(x
i) 1 for i = {1, 2, 3, , k-1, k}
2. The sum of all probabilities in the sample spacemust total one, i.e.
Probability Mass Functions
P(xi) = 1i=1
i=k
-
7/23/2019 2005 GEOG090 Discrete
9/35David Tenenbaum GEOG 090 UNC-CH Spring 2005
The remainder of todays lecture will introduce
three kinds of discrete probability distributions
that are useful for us to examine when learningabout statistics:
1. The Uniform Distribution2. The Binomial Distribution
3. The Poisson Distribution Each of these probability distributions is
appropriately applied in certain situations and to
particular phenomena
Discrete Probability Distributions
-
7/23/2019 2005 GEOG090 Discrete
10/35David Tenenbaum GEOG 090 UNC-CH Spring 2005
The uniform distribution describes the situation
where the probability of all outcomes is the same
The Uniform Distribution
Expressed as an equation,given n possible outcomes
for an event, the probabilityof any outcome is P(xi) =
1/n, e.g. if we are flipping a
coin and we find that headsand tails are equally likely
outcomes, then:P(xheads
) = 1/2 = P(xtails
)
0
0.25
0.50
P(xi)
headsxi
tails
A uniform probability
mass function
-
7/23/2019 2005 GEOG090 Discrete
11/35David Tenenbaum GEOG 090 UNC-CH Spring 2005
While the idea of a uniform distribution might
seem a little simplistic and perhaps useless, it
actually is well applied in two situations:1. When the probabilities are of each and every
possible outcome are truly equal (e.g. the cointoss)
2. When we have no prior knowledge of how a
variable is distributed (i.e. when we are dealing
with complete uncertainty), we first distribution
we should use is uniform, because it makes noassumptions about the distribution
The Uniform Distribution
-
7/23/2019 2005 GEOG090 Discrete
12/35David Tenenbaum GEOG 090 UNC-CH Spring 2005
While truly uniformly distributed geographic
phenomena are somewhat rare (remember
Toblers law, which implies variation from theuniform if it is true), we often encounter the
situation of not knowing how something is
distributed until we sample it
It is in the latter case, when we are resisting
making assumptions about the distribution ofsome geographic phenomenon that we usually
apply the uniform distribution as a sort of nullhypothesis of distribution
The Uniform Distribution
-
7/23/2019 2005 GEOG090 Discrete
13/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
The Uniform Distribution
xi
For example, supposing we wanted to wanted to predictthe direction of the prevailing wind at some location
(expressing it in terms of a cardinal direction), and we
had no prior knowledge of the weather systemstendencies in the area, we would have to begin with the
idea that
P(xNorth
) =
P(xEast
) =
P(xSouth) =
P(xWest
) =
until we had an opportunity to sample and establish sometendency in the wind pattern based on those observations
0
0.25
P(xi)
N E S W
0.125
-
7/23/2019 2005 GEOG090 Discrete
14/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
The binomial distribution provides information
about the probability of the repetition of events
when there are only two possible outcomes, e.g.heads or tails, left or right, success or failure, rain
or no rain any nominal data situation where
there are only two categories / outcomes possible
The binomial distribution is useful for describing
when the same event is repeated over and over,characterizing the probability of a proportion of
the events having a certain outcome over aspecified number of events
The Binomial Distribution
-
7/23/2019 2005 GEOG090 Discrete
15/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
A binomial distribution is produced by a set of
Bernoulli trials, named after Jacques Bernoulli, a
17th
Century Swiss mathematician who formulateda version of the law of large numbers for
independent trials
The law of large numbers is at the heart of
probability theory, and it states that given enough
observed events, the observed probability shouldapproach the theoretical values drawn from
probability distributions (e.g. enough coin tossesshould approach the P=0.5 value for the outcomes)
The Binomial Distribution
-
7/23/2019 2005 GEOG090 Discrete
16/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
A set of Bernoulli trials is the way tooperationally test the law of large numbers using
an event that has two possible outcomes:
1. N independent trials of an experiment (i.e. an
event like a coin toss) are performed; using the
word independent here stipulates that the results
of one trial do not influence the result of the next
2. Every trial must have the same set of possibleoutcomes (heads and tails must be the only
available results of coin tosses using other sortsof experiments, this is a less trivial issue)
Bernoulli Trials
-
7/23/2019 2005 GEOG090 Discrete
17/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
Bernoulli trials cont.3. The probability of each outcome must be the
same for all trials, i.e. P(x
i) must be the sameeach time for both x
ivalues
4. The resulting random variable is determined by
the number of successes in the trials (where we
define successes to be one of the two available
outcomes)
We will use the notation p = the probability of
success in a trial and q = (p 1) as the probabilityof failure in a trial; p + q = 1
Bernoulli Trials
-
7/23/2019 2005 GEOG090 Discrete
18/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
Suppose on a series of successive days, we will recordwhether or not it rains in Chapel Hill
We will denote the 2 outcomes using R when it rains and
N when it does not rainn Possible Outcomes # of Rain Days P(# of Rain Days)
1 R 1 p p
N 0 (1 - p) q
2 RR 2 p2 p2
RN NR 1 2[p*(1 p)] 2pq
NN 0 (1 p)2 q2
3 RRR 3 p3 p3
RRN RNR NRR 2 3[p2 *(1 p)] 3p2q
NNR NRN RNN 1 3[p*(1 p)2] 3pq2
NNN 0 (1 p)3 q3
Bernoulli Trials An Example
>1 successive events
uses the multiplicative
rule (intersection) tocalculate the probability
-
7/23/2019 2005 GEOG090 Discrete
19/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
n Possible Outcomes # of Rain Days P(# of Rain Days)
1 R 1 p = 0.2
N 0 q = 0.8
2 RR 2 p2 = 0.04
RN NR 1 2pq = 0.32
NN 0 q2 = 0.64
3 RRR 3 p3 = 0.008
RRN RNR NRR 2 3p2q = 0.096
NNR NRN RNN 1 3pq2 = 0.384
NNN 0 q3 = 0.512
If we have a value for P(R) = p, we can substitute it into
the above equations to get the probability of each
outcome from a series of successive samples, e.g.suppose p=0.2 (and therefore q=0.8, since p + q = 1)
Bernoulli Trials An Example
= 1
= 1
= 1
-
7/23/2019 2005 GEOG090 Discrete
20/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
Bernoulli Trials
1 event, = (p + q)1 = p + q
2 events, = (p + q)2 = p2 + 2pq + q2
3 events, = (p + q)3
= p3 + 3p2q + 3pq2 + q3
4 events, = (p + q)4= p4 + 4p3q + 6p2q2 + 4pq3 + q4
Source: Earickson, RJ, and Harlin, JM. 1994. Geographic Measurement and Quantitative
Analysis. USA: Macmillan College Publishing Co., p. 132.
A graphical representation: probability# of successes
The sum of the probabilities can be expressed using thebinomial expansion of (p + q)n, where n = # of events
-
7/23/2019 2005 GEOG090 Discrete
21/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
We can provide a general formula for calculatingthe probability of x successes, given n trials and a
probability p of success:
Bernoulli Trials
P(x) = C(n,x) * px * (1 - p)n - x
where C(n,x) is the number of possible
combinations of x successes and (n x) failures:
C(n,x) = n!x! * (n x)!
where n! = n * (n 1) * (n 2) * * 3 * 2 * 1
-
7/23/2019 2005 GEOG090 Discrete
22/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
For example, the probability of 2 successes in 4trials, given p=0.2 is:
Bernoulli Trials - Example
P(x) = n!x! * (n x)!
* px *(1 - p)n - x
P(x) =
24
2 * 2 * (0.2)
2
* (0.8)
2
P(x) = 6 * (0.04)*(0.64) = 0.1536
-
7/23/2019 2005 GEOG090 Discrete
23/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
Calculating the probabilities of all possible outcomes ofthe number of rain days out of four days, given p = 0.2:
x P(x) C(n,x) px (1 p)n x
0 P(0) 1 (0.2)0 (0.8)4 = 0.4096
1 P(1) 4 (0.2)1
(0.8)3
= 0.40962 P(2) 6 (0.2)2 (0.8)2 = 0.1536
3 P(3) 4 (0.2)3 (0.8)1 = 0.0256
4 P(4) 1 (0.2)4 (0.8)0 = 0.0016
Bernoulli Trials - Example
P = product of these terms
We can also calculate the chance of having one or more
days of rain out of four by summing P(1) + P(2) + P(3)
+ P(4) = 0.4096 + 0.1536 + 0.0256 + 0.0016 = 0.5904
i i
-
7/23/2019 2005 GEOG090 Discrete
24/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
Naturally, we can plot the probability massfunction produced by this binomial distribution:
Bernoulli Trials - Example
xi P(xi)
0 0.4096
0.40962 0.1536
3 0.0256
4 0.0016 0
0.25
0.50
P(xi
)
1 2 3 4
xi
0
Th P i Di ib i
-
7/23/2019 2005 GEOG090 Discrete
25/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
The usual application of probability distributionsis to find a theoretical distribution that reflects a
process such that it explains what we see in someobserved sample of a geographic phenomenon
The theoretical distribution does this by virtue of
the fact that the form of the sampled information
and theoretical distribution can be compared and
be found to similar through a test of significance One theoretical concept that we often study in
geography concerns discrete random events inspace and time (e.g. where will a tornado occur?)
The Poisson Distribution
Th P i Di t ib ti
-
7/23/2019 2005 GEOG090 Discrete
26/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
The discrete random events in question happenrarely (if at all), and the time and place of these
events are independent and random The greatestprobability is zero occurrences at a
certain time or place, with a small chance of one
occurrence, an even smaller chance of two
occurrences, etc.
The Poisson Distribution
A distribution withthese characteristics
will be heavilypeaked and skewed:0
0.25
0.5
P(xi
)
1 2 3 4xi
0
Th P i Di t ib ti
-
7/23/2019 2005 GEOG090 Discrete
27/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
In the 1830s, French mathematician S.D. Poissondescribed a distribution with these characteristics,
used to describe thenumber of events
that willoccur within a certain area or duration (e.g. #
of meteorite impacts per state, # of tornados per
year in Tornado Alley)
The following characteristics describe the
Poisson distribution:1. It is used to count the number of occurrences
of an event within a given unit of time, area,volume, etc. therefore a discrete distribution
The Poisson Distribution
Th P i Di t ib ti
-
7/23/2019 2005 GEOG090 Discrete
28/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
Poisson distribution cont.:
2. The probability that an event will occur within
a given unit must be the same for all units (i.e.the underlying process governing the
phenomenon must be invariant)
3. The number of events occurring per unit must
be independent of the number of events
occurring in other units (no interactions)
4. The mean or expected number of event per unit
is denoted by and is found by past experience(observations)
The Poisson Distribution
Th P i Di t ib ti
-
7/23/2019 2005 GEOG090 Discrete
29/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
Poisson formulated his distribution as follows:
The Poisson Distribution
P(x) =
e- * x
x!where e = 2.71828 (base of the natural logarithm)
= the mean or expected value
x = 1, 2, , n 1, n # of occurrences
x! = x * (x 1) * (x 2) * * 2 * 1 To calculate a Poisson distribution, you must
know and then plug in the values of x whereobservations are likely to occur
Th P i Di t ib ti
-
7/23/2019 2005 GEOG090 Discrete
30/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
Poisson formulated his distribution as follows:
The Poisson Distribution
P(x) =
e- * x
x! The shape of the distribution depends quite
strongly upon the value of , because as
increases, the distribution becomes less skewed,
eventually approaching a normal-shapeddistribution as gets quite large
We can evaluate P(x) for any value of x, but largevalues of x will have very small values of P(x)
The Poisson Distrib tion
-
7/23/2019 2005 GEOG090 Discrete
31/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
The Poisson distribution is sometimes known asthe Law of Small Numbers, because it describes
the behavior of events that are rare, despite there
being many opportunities for them to occur
We can observe the frequency of some rare
phenomenon, find its mean occurrence, and then
construct a Poisson distribution and compare
our observed values to those from the distribution(effectively expected values) to see the degree to
which our observed phenomenon is obeying the
Law of Small Numbers:
The Poisson Distribution
The Poisson Distribution Example
-
7/23/2019 2005 GEOG090 Discrete
32/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
Fitting a Poisson distribution to the 24-hour murderrates in Fayetteville in a 31-day month (to ask the
question Do murders randomly occur in time?)
x Obs. Frequency x*Fobs P(x) Fexp
0 17 0 0.49 15.2
1 9 9 0.35 10.92 3 6 0.12 3.7
3 1 3 0.03 0.9
4 1 4 0.005 0.2Total values 31 22 1.000 30.9
The Poisson Distribution - Example
days murders
= mean murders per day = 22 / 31 = 0.71
Observed Values Expected Values
P(x) =e- * x
x!
P(x) = e-0.71 * 0.71x
x!
Fexp = P(x) * 31We can compare Fobsto Fexp using a
2 test
to see if observationsdo match Poisson Dist.
The Poisson Distribution
-
7/23/2019 2005 GEOG090 Discrete
33/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
Procedure for finding Poisson probabilities andexpected frequencies:
1. Set up a table with five columns as on the
previous slide
2. Multiply the values of x by their observed
frequencies (x * fobs)3. Sum the columns of fobs (observed frequency)
and x * fobs4. Compute = (x * fobs) / fobs5. Compute P(x) values using the eqn. or a table
6. Compute the values of Fexp = P(x) * fobs
The Poisson Distribution
The Poisson Distribution
-
7/23/2019 2005 GEOG090 Discrete
34/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
One characteristic of the Poisson distribution isthat we expect the variance ~ mean (i.e. the two
should have approximately the same values)
When we apply the Poisson distribution to
geographic patterns, we can see how a variance
to mean ratio (
2:x) of about 1 corresponds to arandom pattern that is distributed according to
Poisson probabilities
Suppose we have a point pattern in an (x,y)
coordinate space and we lay down quadrats and
count the number of points per quadrat
The Poisson Distribution
The Poisson Distribution
-
7/23/2019 2005 GEOG090 Discrete
35/35
David Tenenbaum GEOG 090 UNC-CH Spring 2005
Here, the counts of points per quadrat form thefrequencies we use to check Poisson probabilities:
The Poisson Distribution
Regular
Low variance
Mean 12:x is low
Random
Variance
Mean2:x ~ 1
Clustered
Low variance
Mean 02:x is high