Download presentation
Presentation is loading. Please wait.
Published byTracey Phillips Modified over 9 years ago
1
Introduction to Biostatistics (ZJU 2008) Wenjiang Fu, Ph.D Associate Professor Division of Biostatistics, Department of Epidemiology Michigan State University East Lansing, Michigan 48824, USA Email: fuw@msu.edu fuw@msu.edu www: http://www.msu.edu/~fuw http://www.msu.edu/~fuw
2
Chapters 4-5 Probability distribution Random Variable (rv) Definition 1. A random variable (r.v.) is a numerical quantity that takes different values with specified probability. Definition 1. A random variable (r.v.) is a numerical quantity that takes different values with specified probability. Definition 2. A discrete r.v. is a r.v. for which there exists a discrete set of values with specified probability. Definition 2. A discrete r.v. is a r.v. for which there exists a discrete set of values with specified probability. Examples: discrete r.v. number of episodes of a disease/symptoms, heart attacks, diarrhea, blood cell counts. Examples: discrete r.v. number of episodes of a disease/symptoms, heart attacks, diarrhea, blood cell counts. Definition 3. A continuous r.v. is a r.v. whose values form a Definition 3. A continuous r.v. is a r.v. whose values form a continuum, and the range of values occur with specified probability. Examples: height, weight, temperature, FEV, blood pressure, etc. Examples: height, weight, temperature, FEV, blood pressure, etc.
3
Probability distribution Definition 4. A probability mass function (PDF) is a mathematical relationship/rule that assigns probability to each possible outcome. Definition 4. A probability mass function (PDF) is a mathematical relationship/rule that assigns probability to each possible outcome. Pr (X = r) – Prob. Distribution Pr (X = r) – Prob. Distribution Example: Hepatitis A. Household with 4 people Example: Hepatitis A. Household with 4 people r: # people contracted H.A r | 0 1 234 Pr (X = r)|.3.1.1.3.2
4
Probability distribution Properties of Probability 1.0 Pr (X = r) 1 2. Total probability ∑ r Pr(X=r) = 1 Expected value of a discrete r.v. Expected value of a discrete r.v. where x i 's are the values X assumes with positive probability. Example Example = 0 x.3 + 1x.1 + 2 x.1 + 3 x.3 + 4 x.2 = 2.0 Interpretation: On the average, a household with 4 people has 2 people contracted Hepatitis A ; or two people are expected to be contracted H.A in a household of 4.
5
Probability distribution Variance of a discrete r.v. X Variance of a discrete r.v. X var (X) = 2 = where x i are the values that X takes with positive probabilities. Variance is the expected value of (X- ) 2, or Variance is the expected value of (X- ) 2, or Var (X) = E [(X- ) 2 ] the expected value of the squared distance from the mean. A short version of var (X) is given by A short version of var (X) is given by
6
Probability distribution Example: 2 = 2 2 x.3+1 2 x.1+0 2 x.1+1 2 x.3+2 2 x.2 = 2.4 or 2 = 0 2 x.3+1 2 x.1+2 2 x.1+3 2 x.3+4 2 x.2 - 2 2 = 2.4 SD (X) = = 1.55 A Rule that is true for most cases A Rule that is true for most cases Approximately 95% of the probability mass falls within two SD of the mean (expected value) of a r.v. 2 = 2.0 2 x 1.55 = 2.0 3.1 = [-1.1, 5.1]
7
Probability distribution Cumulative distribution function (CDF) of a discrete r.v. Cumulative distribution function (CDF) of a discrete r.v. F ( x ) = Pr ( X x ) Example F(0) = Pr (X 0) = Pr (X = 0) =.3 F(1.8) = Pr (X 1.8) = Pr (X = 0) =.3 F(1) = Pr (X 1) = Pr (X < 1) + Pr (X = 1) =.3 +.1 =.4 F(2) = Pr (X 2) = Pr (X < 2) + Pr (X = 2) =.4 +.1 =.5 F(3) = Pr (X 3) = Pr (X < 3) + Pr (X = 3) =.5 +.3 =.8 F(4) = Pr (X 4) = Pr (X < 4) + Pr (X = 4) =.8 +.2 = 1
8
Probability distribution Properties of mean and variance of distribution Properties of mean and variance of distribution Let X, Y and Z are random variables. Let X, Y and Z are random variables. If Y = aX +b with constants a and b, then E(Y) = aE(X) + b Var (Y) = a 2 Var(X) SD (Y) = |a| SD (X) If Z = aX+bY, then E(Z) = a E(X) + b E(Y).
9
Binomial distribution Permutation : The number of permutations of n things taken k at a time is Permutation : The number of permutations of n things taken k at a time is n P k = n (n-1) (n-2) … (n-k+1) It represents the number of ways of selecting k items out of n, where the order of selection is important. It represents the number of ways of selecting k items out of n, where the order of selection is important. 8 P 5 = 8 x 7 x 6 x 5 x 4 = 6720 n P n = n (n-1) (n-2) … x 2 x 1 = n! n! = n factorial = n x (n-1) x … x 2 x 1 Definition 0! = 1.
10
Binomial distribution Combination: the number of combinations of n taken k at a time is Combination: the number of combinations of n taken k at a time is The number of ways to choose 5 doctors from 8 doctors is
11
Binomial distribution The Binomial Distribution The Binomial Distribution n independent trials, each trial has two outcomes: success (1) or failure (0) with constant probability Pr (success) = p, and Pr (failure) = 1 – p = q Example. Flu infection. 5 indep individuals were together. Example. Flu infection. 5 indep individuals were together. Prob (being contracted with flu) =.6 Prob (2 out of 5 contract flu) = ? 1st question: does order matter? Who becomes 1st case, who 2nd. 1st question: does order matter? Who becomes 1st case, who 2nd. No. So use combination. No. So use combination.
12
Binomial distribution Each possibility: F i = {i-th subj. got flu} Each possibility: F i = {i-th subj. got flu} Pr ( F 1 F 2 F 3 F 4 F 5 ) = pxpxqxqxq = p 2 (1-p) 3 = =.6 2 x(1-.6) 3 =.02304 Pr ( F 1 F 2 F 3 F 4 F 5 ) = pxpxqxqxq = p 2 (1-p) 3 = =.6 2 x(1-.6) 3 =.02304 Pr (2 out of 5 flu) = 5 C 2 p 2 (1-p) 3 =10 x.02304 =.2304 Pr (2 out of 5 flu) = 5 C 2 p 2 (1-p) 3 =10 x.02304 =.2304 The combination number represents the total number of different events: The combination number represents the total number of different events: F 1 F 2 F 3 F 4 F 5, F 1 F 2 F 3 F 4 F 5, F 1 F 2 F 3 F 4 F 5, etc.. F 1 F 2 F 3 F 4 F 5, F 1 F 2 F 3 F 4 F 5, F 1 F 2 F 3 F 4 F 5, etc..
13
Binomial distribution Binomial distribution B(n, p) Binomial distribution B(n, p) The distribution of the number of successes in n statistically indep trials with the prob. of success on each trial p is a binomial distribution and has a probability mass function Pr (X = k) = n C k p k (1-p) n-k, k = 0, 1, …, n. Pr (X = k) = n C k p k (1-p) n-k, k = 0, 1, …, n. Example. The ratio of # boys to girls is 2:3 in one classroom. Example. The ratio of # boys to girls is 2:3 in one classroom. Pr (having 3 boys out of 5 children) = ? p = # boys / # children = 2 / (2+3) =.4 Pr (3 boys out of 5) = 5 C 3 p 3 (1-p) 5-3 =10x.4 3 (1-.4) 5-3 =.2304 Pr (3 boys out of 5) = 5 C 3 p 3 (1-p) 5-3 =10x.4 3 (1-.4) 5-3 =.2304 Pr (having at least 3 boys out of 5 children) = ? Pr (3 boys out of 5) + Pr (4 boys out of 5) + Pr (5 boys out of 5) =.2304 + 5x.0256x.6 + 1x.01024x1 =.3174
14
Binomial distribution Binomial distribution B(n, p) Binomial distribution B(n, p) Binomial Table n = 2, 3, …, 20, p =.05, 01,.15, …,.50. Binomial Table n = 2, 3, …, 20, p =.05, 01,.15, …,.50. Recursion rule --- simplify the calculation of binomial prob. in the old days. Recursion rule --- simplify the calculation of binomial prob. in the old days. Pr (X=k+1) = (n-k) / (k+1) * p/q * Pr (X=k), k=0,1,2,… If Pr (X=0) is known, then Pr (X=1) is known, then Pr (X=2), …, New Approach: computer programs: Splus, R, SAS, etc. New Approach: computer programs: Splus, R, SAS, etc. In R: dbinom(x, n, p), pbinom(x, n, p), qbinom(x, n, p),
15
Binomial distribution Expected value and variance of binomial dist B(n, p) Expected value and variance of binomial dist B(n, p) Var (X) = np(1-p) Some important points of B(n, p) Some important points of B(n, p) 1. mean and variance depend on n and p. 2 The larger the number of trials, the larger the mean and variance. 3 The larger the probability of success p, the larger the mean. 4 var (X) is small for very small p close to 0 and very large p close to 1. It attains the maximum value at p =.5 with var (X) = n/4. p =.5 : success and failure are equally likely to occur. Toss a coin. p =.5 : success and failure are equally likely to occur. Toss a coin.
16
Binomial distribution Example Disease asthma caused by pollution from nearby industry Example Disease asthma caused by pollution from nearby industry p = Pr(having asthma nationwide) =.03 (reference level). In a small community of n=100, we observe 8 cases. Is this an alarming evidence of asthma? In a small community of n=100, we observe 8 cases. Is this an alarming evidence of asthma? Pr (having asthma in community) = 8/100 =.08 > reference level Pr (having asthma in community) = 8/100 =.08 > reference level Is this much higher? Usually or unusually high? With a small probability? Is this much higher? Usually or unusually high? With a small probability? Is {having 8 cases} a small probability event? If {8 cases} is unusually high, then {9 cases}, {10 cases}… all high. If {8 cases} is unusually high, then {9 cases}, {10 cases}… all high. Criterion to use Criterion to use Is {having at least 8 cases} a small probability event?
17
Binomial distribution So need Pr (at least 8 cases) = Pr (X 8) So need Pr (at least 8 cases) = Pr (X 8) Need to calculate 100 –8 +1 = 93 probabilities. Need to calculate 100 –8 +1 = 93 probabilities. Pr (at least 8 cases) = 1- Pr (at most 7 cases) = = 1 – ∑ k=0 7 Pr(X=k) = 0.028, A small probability event (< 0.05) based on reference. Claim that having such a small probability event is very unlikely. Interpretation: However, since we have observed such a small probability event, we believe this is an unusual observation, or having observed 8 cases out of 100 in the community is alarmingly high.
18
Poisson distribution Three assumptions for Poisson distribution Three assumptions for Poisson distribution 1. The event is rare, i.e. Pr (observing 1 event instantly ) ≈ λ Δt; Pr (observe > 1 events instantly ) ≈ 0 Pr (0 event) ≈ 1- λ Δt. 2. Stationary process. The number of events per unit time remains the same during the entire duration of time. 3. Independence. The outcome in one time interval does not affect the probability of another time interval of no time overlap. Poisson distribution Poisson distribution Pr (X=k) = e –μ μ k / k!, k = 0, 1, 2, … Where μ = λ t, t is the time duration or area, λ is the intensity per unit. Notice that k has no upper bound or ceiling. Notice that k has no upper bound or ceiling.
19
Poisson distribution Mean and variance of Poisson distribution Mean and variance of Poisson distribution E(X) = ∑ k k Pr (X=k) = ∑ k k e –μ μ k / k! = μ E(X) = ∑ k k Pr (X=k) = ∑ k k e –μ μ k / k! = μ Var (X) = ∑ k k 2 Pr (X=k) – [E(X)] 2 = μ That’s why Poisson distribution has only one parameter μ. That’s why Poisson distribution has only one parameter μ. Example. Example. Assume 3 traffic accidents are expected in the city of Detroit every day in the winter (Nov – Feb), while only 1 accident is expected per day other time of the year due to the weather conditions. If 5 accidents were observed on one day, was this an alarming event? Distribution? No cap or upper bound of # events (n). So use Poisson distribution. Distribution? No cap or upper bound of # events (n). So use Poisson distribution. Warning: only use this distribution in the time period when the intensity λ remains constant; should not use for whole year! Why? Warning: only use this distribution in the time period when the intensity λ remains constant; should not use for whole year! Why?
20
Poisson distribution Notice the 2 different intensities, winter ( λ=3) and other ( λ=1). Notice the 2 different intensities, winter ( λ=3) and other ( λ=1). If the day was in winter, λ=3 If the day was in winter, λ=3 Pr(k≥5) = 1- [Pr(k=0)+ …+ Pr(k=4)]= 1-0.815 = 0.185 If the day was in summer, λ=1 If the day was in summer, λ=1 Pr(k≥5) = 1- [Pr(k=0)+ …+ Pr(k=4)]= 1-0.996 =0.004, a small probability event. Conclusion, if 5 accidents were observed in the summer, it was alarmingly high, but not in the winter. Conclusion, if 5 accidents were observed in the summer, it was alarmingly high, but not in the winter. How to work on the prob of observing 20 in 2 consecutive months (Feb & March) together? How to work on the prob of observing 20 in 2 consecutive months (Feb & March) together?
21
Gaussian (Normal) distribution Continuous rv X ~Gaussian distrib. N( μ, σ 2 ) Continuous rv X ~Gaussian distrib. N( μ, σ 2 ) Prob density function (PDF) for some parameters , with > 0. 2 parameters , 2 determine the distribution, the mean for location and variance 2 for shape. X may take any real number, either > 0 or 0 or < 0. f is symmetric about . f is symmetric about . F: the cumulative distribution function CDF F: the cumulative distribution function CDF
22
Standard normal distribution X ~standard normal distrib. N( 0, 1) X ~standard normal distrib. N( 0, 1) Prob density function (PDF) X may take any real number, either > 0 or 0 or < 0. f is symmetric about 0. f is symmetric about 0. Φ : the cumulative distribution function CDF Φ : the cumulative distribution function CDF A very useful function in statistics. Φ (-x) = 1 – Φ (x), frequently used for the calculation of p-value. Φ (-x) = 1 – Φ (x), frequently used for the calculation of p-value.
23
Properties of N (0, 1) Properties of standard normal N (0, 1) Properties of standard normal N (0, 1) PDF f (x), – < x < 1). symmetric about 0: f (x) = f (– x) 1). symmetric about 0: f (x) = f (– x) 2). Pr (-1 X 1) =.6827, or 2). Pr (-1 X 1) =.6827, or about 68% (more than 2/3) of the area lies in [–1, 1]. Pr (-1.96 X 1.96) =.95, or about 95% area lies between –1.96 and 1.96. Pr (-2.576 X 2.576) =.99, or Pr (-2.576 X 2.576) =.99, or about 99% area lies between –2.5 and 2.5
24
Illustration of N (μ, σ 2 ) 68 % 95.4% 99.7% 68% 95% 99.7%
25
Special notation for N(0,1) Definition The 100 x uth percentile of N (0,1) is denoted by Definition The 100 x uth percentile of N (0,1) is denoted by Zu :Pr ( X Zu ) = u, where X N (0,1) then (Zu) = Pr ( X Zu ) = u Frequently used quantiles Z.975, Z.95, Z.5, Z.05, Z.025 Frequently used quantiles Z.975, Z.95, Z.5, Z.05, Z.025 (1.96) =.975, (1.645) =.95, (0) =.5 (-1.645) = 1 - (1.645) = 1 -.95 =.05 (-1.96) = 1 - (1.96) = 1 -.975 =.025 Z.975 = 1.96. Z.95 = 1.645Z.5 = 0 Z.05 = -1.645Z.025 = -1.96
26
Calculation of probability X ~ N( μ, σ 2 ). Calculate Pr (a < X< b) X ~ N( μ, σ 2 ). Calculate Pr (a < X< b) Z = (X- μ) / σ, then Z ~ N(0,1), use . Z = (X- μ) / σ, then Z ~ N(0,1), use . Pr (a < X< b) Pr (a < X< b) = Pr {[(a-μ)/ σ] < [ (X-μ)/ σ] < [ (b-μ)/ σ]} = Pr {[(a-μ)/ σ] < Z < [ (b-μ)/ σ]} = [(b-μ)/ σ] - [(a-μ)/ σ] Example: Hypertension. SBPX N (80, 144 ) Example: Hypertension. SBPX N (80, 144 ) Pr (90 < X < 95)=Pr[(90 – 80)/12 <X< (95-80)/12] = Pr (.83 < Z < 1.25 ) = ( 1.25 ) - (.83 ) =.8944 -.7967 =.098
27
Calculation of probability Example: Cerebrovascular disease. Example: Cerebrovascular disease. To Diag. stroke, use cerebral blood flow (CBF), clinically diagnose patient at risk: CBF < 40. Assume normal people's CBF has normal distribution with mean 75 and SD = 17. Find percentage of normal people mistakenly classified by CBF as stroke patients. Assume normal people's CBF has normal distribution with mean 75 and SD = 17. Find percentage of normal people mistakenly classified by CBF as stroke patients. Let X be CBF in normal person. Then X N (75, 17 2 ) Let X be CBF in normal person. Then X N (75, 17 2 ) Need to find Pr (X < 40). Pr (X < 40) = Pr (Z < (40 – 75)/17 ) = Pr (Z < – 2.06) Pr (X < 40) = Pr (Z < (40 – 75)/17 ) = Pr (Z < – 2.06) = (– 2.06) = 1 – (2.06) = 1 –.9803 =.02 = 2 % = (– 2.06) = 1 – (2.06) = 1 –.9803 =.02 = 2 %
28
Approximation of distribution Bin (n, p) can be difficult to calculate, Bin (n, p) can be difficult to calculate, Pois (μ) can also be difficult to calculate. Pois (μ) can also be difficult to calculate. Easy to calculate N (0,1). Easy to calculate N (0,1). Need: use Normal distribution to approximate others so that the computation will be much easier, and yet the probability accuracy will not be compromised a lot. Need: use Normal distribution to approximate others so that the computation will be much easier, and yet the probability accuracy will not be compromised a lot.
29
Pois (μ) Approximation to Bin (n, p) Basic judgment: two distributions must be close Basic judgment: two distributions must be close to each other enough: their parameters close: μ 1 and μ 2 are close, and σ 1 2 and σ 2 2 are close. μ 1 and μ 2 are close, and σ 1 2 and σ 2 2 are close. Bin (n, p) mean np, var npq Bin (n, p) mean np, var npq Pois (μ) mean μ, var μ. Pois (μ) mean μ, var μ. So np ≈ npq and moderate. So np ≈ npq and moderate. When n large, p small (q = 1-p close to 1) and np is moderate, can approximate X ~ Bin (n,p) with Y ~ Pois(np). When n large, p small (q = 1-p close to 1) and np is moderate, can approximate X ~ Bin (n,p) with Y ~ Pois(np).
30
Normal Approximation to Bin (n, p) Normal Approximation to Bin (n, p) Bin (n, p) mean np, var npq Bin (n, p) mean np, var npq N (μ, σ 2 ) mean μ, var σ 2. Bin (n,p) needs to be roughly symmetric. Bin (n,p) needs to be roughly symmetric. When npq ≥ 5, can approximate X ~ Bin (n,p) with Y ~ N(np, npq). When npq ≥ 5, can approximate X ~ Bin (n,p) with Y ~ N(np, npq). Pr(X=k) = Pr(k-.5 <Y<k+.5); Pr(X=k) = Pr(k-.5 <Y<k+.5); Pr(X≥k) = Pr( Y > k-.5) Pr(X≤k) = Pr( Y < k+.5) If use normal approximation, n ≥ 20. Why? If use normal approximation, n ≥ 20. Why? If p is so small that npq < 5, then do not use normal approximation, but rather use Poisson approximation. If p is so small that npq < 5, then do not use normal approximation, but rather use Poisson approximation.
31
Normal Approximation to Pois (μ) Normal Approximation to Pois (μ) Pois (μ) mean μ, var μ Pois (μ) mean μ, var μ N (μ, σ 2 ) mean μ, var σ 2. Pois (μ) needs to be roughly symmetric. Pois (μ) needs to be roughly symmetric. When μ ≥ 10, can approximate X ~ Pois (μ) with Y ~ N(μ, μ). When μ ≥ 10, can approximate X ~ Pois (μ) with Y ~ N(μ, μ). Pr(X=k) = Pr(k-.5 <Y<k+.5); Pr(X=k) = Pr(k-.5 <Y<k+.5); Pr(X≥k) = Pr( Y > k-.5) Pr(X≤k) = Pr( Y < k+.5)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.