Lecture-6Lecture-6
Models for DataModels for Data
1. Discrete Variables1. Discrete Variables
Engr. DrAttaullah ShahEngr. DrAttaullah Shah
Leukemia-Statistics-lg
Syracuse_Weather_Statistics
Statistical Models
In Statistics the distribution of random variable in a data isexpressed by one or more equation.
A simple model for the measurement made by an instrument: X= θ + ε
θ is the true value of what is being measured, and ε is ameasurement error.
A plausible model is selected to ensure that the data is inagreement with the model.
 For this purpose both the type of model and distribution of r.v isimportant to know.
There are a number of distribution variables used for data, suchas for Discrete Statistical Distributions, we use The Hyper-geometric DistributionThe Binomial Distribution, ThePoisson Distribution and for continuous statisticaldistribution we use Normal or Gaussian Distribution,Exponential Distribution, Lognormal Distribution etc.
Discrete vs. Continuous Random Variables
DISCRETEDISCRETE
CONTINUOUSCONTINUOUS
Values that can be counted and orderedValues that can be counted and ordered
Values that cannot be countedValues that cannot be counted
Gap between consecutive valuesGap between consecutive values
On continuous spectrumOn continuous spectrum
Examples:Examples:
1) Insurance claims filed in one day1) Insurance claims filed in one day
2) Cars sold in one month2) Cars sold in one month
3) Employees who call in sick on day3) Employees who call in sick on day
Examples:Examples:
1)Time to check out customer1)Time to check out customer
2)Weight of an outgoing shipment2)Weight of an outgoing shipment
3)Distance traveled by truck in singleday3)Distance traveled by truck in singleday
4)Price of gallon of gas4)Price of gallon of gas
Measure with specific amount ofprecisionMeasure with specific amount ofprecision
Discrete Statistical Distribution
discrete distribution is one for which the random variable beingconsidered can only take on certain specific values, rather thanany value within some range. The possible values are 0, 1, 2, 3,and so on.
It is conventional to denote a random variable by a capital anda particular observed value by a lowercase x. A discretedistribution is then defined by a list of the possible values x1x2,x3, …, for X, and the probabilities P(x1),P(x2), P(x3), …, for thesevalues.
 P(x1) + P(x2) + P(x3) + … = 1
Often there is a specific equation for the probabilities defined bya probability function P(x) = Prob(x). where P(x) is somefunction of x.
The mean of a random variable is sometimes called the expectedvalue, and is usually denoted either by μ or E(X).
E(X) =ΣxiP(xi ) = x1P(x1), x2P(x2), x3P(x3)+……
The variance of a discrete distribution is equal tothe sample variance that would be obtained for avery large sample from the distribution.
The square root of the variance, σ, is the standarddeviation of the distribution
Example:
Two thrown are thrown at a time, the possibleoutcomes are ( HH, HT, TH, TT)
If a random variable X=No of heads
p(x=0) = 1/4 , p(x=1)=2/4=1/2, p(x=2)=1/4
E(x)=xp(x)= 0.(1/4)+1.(1/2)+2(1/4) = ½+ ½ =1
The Hypergeometric Distribution
when a random sample of size is taken from a population of Nunits.
If the population contains units with a certain characteristic, thenthe probability that the sample will contain exactly units with thecharacteristic is: P(x) = RCx N−RCn−x/NCn, for = 0, 1, …,Min(n,R).
where aCb denotes the number of combinations of objects takenat a time.
The mean and variance are
μ = nR/and
σ2 = [nR (− R)(− n)]/[N2 (− 1)].
Hypergeometric Probability Distribution
Where  total number of elements in the populationWhere  total number of elements in the population
number of success in the populationnumber of success in the population
N-r number of failures in the populationN-r number of failures in the population
number of trials (sample size)number of trials (sample size)
xnumber of successes in trialxnumber of successes in trial
 n-xnumber of failures in trials n-xnumber of failures in trials
Hypergeometric Probability DistributionExample
Suppose we select 5 cards from an ordinary deck of playing cards.  What isthe probability of obtaining 2 or fewer hearts?
Solution: 
N = 52; since there are 52 cards in a deck.
r = 13; since there are 13 hearts in a deck.
n = 5; since we randomly select 5 cards from the deck.
x = 0 to 2; since our selection includes 0, 1, or 2 hearts.
We plug these values into the hyper geometric formula as follows:
p(x=0-2)=p(x=0)+p(x=1)+p(x=2)=0.2215+0.2743+0.4114= 9.072 = 90.72%
(a)(a)Hypergeometric Distributions
      Can U verify these curves?
The Binomial Distribution
Suppose that it is possible to carry out a certain type of trial andthat, when this is done, the probability of observing a positiveresult is always for each trial, irrespective of the outcome of anyother trial. Then if trials are carried out, the probability ofobserving exactly positive results is given by the binomialdistribution:
P(x) = nCxpx(1 − pnx, for = 0, 1, 2, …, n
For example when a single dice is thrown, the probability ofgetting 1 is 1/6. If p=1/6 then 1-p = 5/6. If the dice is thrown n=50times, what is the probability of x=1,2 and 3.
Case Study
Inspecting water samples
The number X of turbidity  pollution in ppm  hasapproximately the binomial distribution with n=10 andp=0.1.  Find the probability of getting or ppm in asample of 10.
If X has the binomial distribution with n observations andprobability p of success on each observation, then the meanand standard deviation of X areIf X has the binomial distribution with n observations andprobability p of success on each observation, then the meanand standard deviation of X are
Mean and Standard Deviation
Case Study
Inspecting water samples
number X of turbidity  pollution in ppm  has approximatelythe binomial distribution with n=10 and p=0.1.  Find themean and standard deviation of this distribution.
µ = np = (10)(0.1) = 1
the probability of each sample being bad is one tenth;so we expect (on average) to get 1 bad one out of the10 sampled
(b) Binomial Distributions
Binomial Probability Distribution
fixed number of observations (trials), nfixed number of observations (trials), n
e.g., 15 tosses of coin; 20 patients; 1000 people surveyede.g., 15 tosses of coin; 20 patients; 1000 people surveyed
binary random variablebinary random variable
e.g., head or tail in each toss of coin; defective or notdefective light bulbe.g., head or tail in each toss of coin; defective or notdefective light bulb
Generally called “success” and “failure”Generally called “success” and “failure”
Probability of success is p, probability of failure is – pProbability of success is p, probability of failure is – p
Constant probability for each observationConstant probability for each observation
e.g., Probability of getting tail is the same each time wetoss the coine.g., Probability of getting tail is the same each time wetoss the coin
Binomial distribution
Intuitive explanation of binomialdistribution formula:Intuitive explanation of binomialdistribution formula:
   Take the example of coin tosses.  What’sthe probability that you flip exactly headsin coin tosses?   Take the example of coin tosses.  What’sthe probability that you flip exactly headsin coin tosses?
Example 2
    As visitors exit the park  on April 20, you ask arepresentative random sample of visitors if theyfeel pollen allergy in the park. If the true percentageof visitors who say yes is 55.1%, what is theprobability that exactly of them have allergy and 4of them did not have the allergy?    As visitors exit the park  on April 20, you ask arepresentative random sample of visitors if theyfeel pollen allergy in the park. If the true percentageof visitors who say yes is 55.1%, what is theprobability that exactly of them have allergy and 4of them did not have the allergy?
  
Binomial distribution: example
If toss coin 20 times, what’s the probabilityof getting of getting or less heads?If toss coin 20 times, what’s the probabilityof getting of getting or less heads?
The Poisson Distribution
One derivation of the Poisson distribution is as the limiting formof the binomial distribution as tends to infinity and tends tozero, with the mean μ = np remaining constant.
The probability function is
P(x) = μxexp(−μ) /x!, for = 0, 1, 2, …, n.
 represents average number of occurrences in an interval.μ represents average number of occurrences in an interval.
represents the actual number of occurrencesrepresents the actual number of occurrences
e is approximately 2.71828e is approximately 2.71828
The mean and variance are both equal to μ.
In terms of events occurring in time, the type of situation wherea Poisson distribution might occur is for counts of the numberof occurrences of minor oil leakages in a region per month, orthe number of cases per year of a rare disease in the sameregion. For events occurring in space, a Poisson distributionmight occur for the number of rare plants found in randomlyselected meter-square quadrats taken from a large area
The Poisson Distribution
Example
For example, if new cases of avian flu inAsia are occurring at rate of about permonth, then these are the probabilities that:0,1, 2, 3, 4, cases will occur in Asia in thenext month:For example, if new cases of avian flu inAsia are occurring at rate of about permonth, then these are the probabilities that:0,1, 2, 3, 4, cases will occur in Asia in thenext month:
Poisson Probability table
X
P(X)
0
=.135
1
=.27
2
=.27
3
=.18
4
=.09
5
 
Example: Poisson distribution
Suppose that a rare disease has an incidence of 1 in 1000 person-years.  Assuming that members of the population are affectedindependently, find the probability of k cases in a population of10,000 (followed over 1 year) for k=0,1,2.
 
The expected value (mean) = =np= .001*10,000 = 10
10 new cases expected in this population per year
Home Assignment:
Hyper geometric Distribution:Hyper geometric Distribution:
7 students were selected from a total of class 45 students  ofStatistical Environment containing 15 PhD students. What isthe probability of obtaining 3 or fewer PhD students?
Binomial Distribution:Binomial Distribution:
What is the probability of  getting if fair dice is thrown 100times?What is the probability of  getting if fair dice is thrown 100times?
Poisson Distribution:Poisson Distribution:
colony of 200 people were checked for pollen allergy and itwas found that only persons had the diseases. What is theprobability that 10 people in population of 1000 people willhave the problem?colony of 200 people were checked for pollen allergy and itwas found that only persons had the diseases. What is theprobability that 10 people in population of 1000 people willhave the problem?