Post on 22-Dec-2015
Ch 7 實習Ch 7 實習
助教介紹 助教 : 王珊彗 身分 :博士班 ,6年級 聯絡方式 : Shanhueiwang@gmail.com 工作 :實習課、出作業、寄信 ~~
作業問題 回信問題
Shan Huei, Wang2
實習課時間 (暫定 ,依老師進度修改 )
Shan Huei, Wang3
星期四 日期 ( )電腦 三 日期 ( )電腦 四 日期 ( )實習 五 作業 繳交時間
10月16日Random Variables and Discrete Probability
DistributionsCh 7 10月17日 V HW4 (Ch7) 10月23日
10月23日 Continuous Probability Distributions Ch 8 10 22月 日 (Ch7-8) 10 23月 日 (Ch7-8) 10月24日 V HW5 (Ch8,電腦7-8) 10月30日10月30日 Sampling Distributions Ch 9 10月31日 V HW6 (Ch9)+複習題目 11月6日11月6日 Review 11 5月 日 project 11 6月 日 project X project 11月27日11月13日 Mid-term Exam X X
11月20日 Statistical Inference: Estimation Ch 10 11月21日 V X
11月27日 Statistical Inference: Estimation Ch 10 11月28日 V HW7 (ch 10) 12月4日12月4日 Statistical Inference: Hypothesis Testing Ch 11 12月5日 V HW8 (ch11) 12月11日12月11日 Statistical Inference: Hypothesis Testing Ch 11 12 10月 日 (Ch10-11) 12 11月 日 (Ch10-11) 12月12日 V HW9(Ch10-11電腦 ) 12月18日12月18日 Statistical Inference: Inference about a Population Ch 12 12月19日 V HW10(ch12,電腦 ) 12月25日12月25日 Statistical Inference: Inference about a Population Ch 12 12 24月 日 (Ch12)+office hour 12 25月 日 (Ch12)+office hour 12月26日 V X
1月8日 Final Exam X X
Agenda
Random variable and Probability Distribution The Mean and the Variance Bivariate Distributions Marginal Probabilities Portfolio concept
Overall review of Chapter 7 and 8 Poisson Distribution Binomial distribution
Shan Huei, Wang4
Shan Huei, Wang5
1. Random Variables and Probability Distributions
骰子出現 : 1,3,4,5,2,4,5,6,3,2, 1,1,2,3若有 100次結果,你要如何告訴別人 ?
A random variable is a function or rule that assigns a numerical value to each simple event in a sample space. 為了降低分析的複雜性,將所有可能結果加以數值化 例如投銅板十次,正面出現次數的事件就是 random
variable 短期不知道是什麼,長期下來會呈現某種分配
Shan Huei, Wang6
1. Random Variables and Probability Distributions
There are two types of random variables: Discrete random variable (C7) Continuous random variable (C 8)
Shan Huei, Wang7
A table, formula, or graph that lists all possible values a discrete random variable can assume, together with associated probabilities, is called a discrete probability distribution
To calculate the probability that the random variable X assumes the value x, P(X = x), add the probabilities of all the simple events for which X is
equal to x, or Use probability calculation tools (tree diagram), Apply probability definitions
1.1 Discrete Probability Distribution
Shan Huei, Wang8
The number of cars a dealer is selling daily were recorded in the last 100 days. This data was summarized in the table below.
Estimate the probability distribution, and determine the probability of selling more than 2 cars a day.
Daily sales Frequency0 51 152 353 254 20
100
Example 1
Shan Huei, Wang9
0 1 2 3 4
From the table of frequencies we can calculate the relative frequencies, which becomes our estimated probability distribution
Daily sales Relative Frequency0 5/100=.051 15/100=.152 35/100=.353 25/100=.254 20/100=.20
1.00
.05
.15
.35.25
.20
X
P(X>2) = P(X=3) + P(X=4) =.25 + .20 = .45
Solution
10
Example 2 NTU Company tracks the number of desktop computer systems it
sells over a year (360 days), assume they take the two-day order policy, please use the following information to decide the best order number so that they can satisfy 70% customers’ need. Note: For example, 26 days out of 360, 2 desktops were sold
Shan Huei, Wang
Shan Huei, Wang11
1. 1 Describing the Population/ Probability Distribution
The probability distribution represents a population We’re interested in describing the population by
computing various parameters. Specifically, we calculate the population mean and
population variance.
Shan Huei, Wang12
1.1 Population Mean (Expected Value) and Population Variance
Given a discrete random variable X with values xi, that occur with probabilities p(xi), the population mean of X is. 加權平均概念 (權數是機率 )
Let X be a discrete random variable with possible values xi that occur with probabilities p(xi), and let E(xi) = .m The variance of X is defined by
ixall
ii )x(px)X(E
2
isdeviationdardtansThe
[ ] å m-=m-=s=
ixalli
2i
22 )x(p)x()X(E)X(V
Shan Huei, Wang13
Laws of Expected Value E(c) = c E(X + c) = E(X) + c E(cX) = cE(X)
Laws of Variance V(c) = 0 V(X + c) = V(X) V(cX) = c2V(X)
1.1 Laws of Expected Value and Variance
Shan Huei, Wang14
1.1 The Mean and the Variance
The variance can also be calculated as follows:
Proof2
2 2
2 2
2 2
[( ) ]
[ 2 ]
( ) 2 ( ) ( )
( )
E X
E X X
E X E X E
E X
Shan Huei, Wang15
Example 2
We are given the following probability distribution:
a. Calculate the mean, variance, and standard deviation b. Suppose that Y=3X+2. For each value of X, determine the value
of Y. What is the probability distribution of Y? c. Calculate the mean, variance, and standard deviation from the
probability distribution of Y. d. Use the laws of expected value and variance to calculate the
mean, variance, and standard deviation of Y from the mean, variance, and standard deviation of X. Compare your answers in Parts c and d. Are they the same (except for rounding)
x 0 1 2 3
P(x) 0.4 0.3 0.2 0.1
Shan Huei, Wang16
Solution
a. E(X) = 0(0.4) +1(0.3) + 2(0.2) +3(0.1) = 1 V(X)=E(X2)-{E(X)}2
=(0)2(0.4)+(1)2(0.3)+(2)2(0.2)+(3)2(0.1)-(1)2 =1
b.
x 0 1 2 3
y 2 5 8 11
P(y) 0.4 0.3 0.2 0.1
1)( X
Shan Huei, Wang17
Solution
c. E(Y) = 2(0.4) + 5(0.3) + 8(0.2) + 11(0.1) = 5 V(Y)=E(Y2)-{E(Y)}2
=(2)2(0.4)+(5)2(0.3)+(8)2(0.2)+(11)2(0.1)-(5)2 =9
d. E(Y) = E(3X+2) = 3E(X)+2 = 5 V(Y) = V(3X+2) = 9V(X) = 9
( ) 3Y
Shan Huei, Wang18
1.2 Bivariate Distributions
The bivariate (or joint) distribution is used when the relationship between two random variables is studied. 也就是第六章所看到的聯合機率分配
The probability that X assumes the value x, and Y assumes the value y is denoted p(x,y) = P(X=x and Y = y)
1y)p(x, 2.1y)p(x,0 1.
:conditionsfollowingthesatisfies functiony probabilitjoint The
xall y all
Shan Huei, Wang19
Example 7.5 Xavier and Yvette are two real estate agents.
Let X and Y denote the number of houses that Xavier and Yvette will sell next week, respectively.
The bivariate probability distribution is presented next.
1.2 Bivariate Distributions
Shan Huei, Wang20
p(x,y)
1.2 Bivariate Distributions
X
YX=0 X=2X=1
y=1
y=2
y=0
0.42
0.120.21
0.070.06
0.02
0.06
0.03
0.01
Example 7.5 – continued X
Y 0 1 20 .12 .42 .061 .21 .06 .032 .07 .02 .01
Shan Huei, Wang21
1.3 Marginal Probabilities
Example 7.5 – continued Sum across rows and down columns
XY 0 1 2 p(y)0 .12 .42 .06 .601 .21 .06 .03 .302 .07 .02 .01 .10p(x) .40 .50 .10 1.00
p(0,0)p(0,1)p(0,2)
The marginal probability P(X=0)
P(Y=1), the marginal probability.
Shan Huei, Wang22
1.3 Describing the Bivariate Distribution
The joint distribution can be described by the mean, variance, and standard deviation of each variable.
This is done using the marginal distributions.
x p(x) y p(y)0 01 1 2 2
E(X) = E(Y) = V(X) = V(Y) =
XY 0 1 2 p(y)0 .12 .42 .06 .601 .21 .06 .03 .302 .07 .02 .01 .10p(x) .40 .50 .10 1.00
Shan Huei, Wang23
1.3 Describing the Bivariate Distribution
The joint distribution can be described by the mean, variance, and standard deviation of each variable.
This is done using the marginal distributions.
x p(x) y p(y)0 .4 0 .61 .5 1 .32 .1 2 .1
E(X) = .7 E(Y) = .5V(X) = .41 V(Y) = .45
XY 0 1 2 p(y)0 .12 .42 .06 .601 .21 .06 .03 .302 .07 .02 .01 .10p(x) .40 .50 .10 1.00
Shan Huei, Wang24
1.3 Describing the Bivariate Distribution
To describe the relationship between the two variables we compute the covariance and the coefficient of correlation Covariance:
COV(X,Y) = S(X – mx)(Y- my)p(x,y)=E(XY)-E(X)E(Y)
Coefficient of Correlation
COV(X,Y) sxsy
Shan Huei, Wang25
Example 7.6 Calculate the covariance and coefficient of correlation between
the number of houses sold by the two agents in Example 7.5 Solution
COV(X,Y) = S(x-mx)(y-my)p(x,y) = (0-.7)(0-.5)p(0,0)+…(2-.7)(2-.5)p(2,2) = -.15
r=COV(X,Y)/sxsy = - .15/(.64)(.67) = -.35
1.3 Describing the Bivariate Distribution
XY 0 1 2 p(y)0 .12 .42 .06 .601 .21 .06 .03 .302 .07 .02 .01 .10p(x) .40 .50 .10 1.00
Shan Huei, Wang26
1.3 Sum of Two Variables
The probability distribution of X + Y is determined by Determining all the possible values that X+Y can assume For every possible value C of X+Y, adding the probabilities of all
the combinations of X and Y for which X+Y = C Example 7.5 - continued
Find the probability distribution of the total number of houses sold per week by Xavier and Yvette.( X:0-2, Y: 0-2)
Solution X+Y is the total number of houses sold. X+Y can have the
values 0, 1, 2, 3, 4.
Shan Huei, Wang27
The distribution of X+Y
如何求得P(X+Y)?
x + y 0 1 2 3 4p(x+y) .12 .63 .19 .05 .01
1.3 The Probability Distribution of X+Y
Shan Huei, Wang28
P(X+Y=0) = P(X=0 and Y=0) = .12
P(X+Y=1) = P(X=0 and Y=1)+ P(X=1 and Y=0) =.21 + .42 = .63
P(X+Y=2) = P(X=0 and Y=2)+ P(X=1 and Y=1)+ P(X=2 and Y=0) = .07 + .06 + .06 = .19
The probabilities P(X+Y)=3 and P(X+Y) =4 are calculated the same way. The distribution follows
XY 0 1 2 p(y)0 .12 .42 .06 .601 .21 .06 .03 .302 .07 .02 .01 .10p(x) .40 .50 .10 1.00
1.3 The Probability Distribution of X+Y
Shan Huei, Wang29
The distribution of X+Y
The expected value and variance of X+Y can be calculated from the distribution of X+Y. E(X+Y)=0(.12)+ 1(63)+2(.19)+3(.05)+4(.01)=1.2 V(X+Y)=(0-1.2)2(.12)+(1-1.2)2(.63)+… =.56
x + y 0 1 2 3 4p(x+y) .12 .63 .19 .05 .01
1.3 The Expected Value and Variance of X+Y
Shan Huei, Wang30
1.3 The Expected Value and Variance of X+Y
The following relationship can assist in calculating E(X+Y) and V(X+Y)E(X+Y) =E(X) + E(Y); V(X+Y) = V(X) +V(Y) +2COV(X,Y) When X and Y are independent COV(X,Y)
= 0, and V(X+Y) = V(X)+V(Y).Proof
),(2)()(
)])((2)()[(
])[()(22
2
YXCovYVarXVar
YXYXE
YXEYXVar
yxyx
yx
Shan Huei, Wang31
Example 3
The bivariate distribution of X and Y is described here.
a. Find the marginal probability distribution of X. b. Find the marginal probability distribution of Y c. Compute the mean and variance of X d. Compute the mean and variance of Y e. Compute the covariance and variance of Y
x
y 1 2
1 0.28 0.42
2 0.12 0.18
Shan Huei, Wang32
Solution
a x P(x) 1 .4 2 .6 b y P(y) 1 .7 2 .3 c E(X) = 1(.4) + 2(.6) = 1.6 V(X) = (1–1.6)^2*(.4) + (2–1.6)^2*(.6) = .24 or (1^2)*0.4+(2^2)*0.6-(1.6)^2=.24
Shan Huei, Wang33
Solution
d E(Y) = 1(.7) + 2(.3) = 1.3 V(Y) = (1–1.3)^2(.7) + (2–1.3)^2(.3) = .21 e E(XY) = (1)(1)(.28) + (1)(2)(.12) + (2)(1)(.42) + (2)(2)(.18) = 2.08
COV(X, Y) = E(XY)–E(X)E(Y) = 2.08 – (1.6)(1.3) = 0 = 0
yx
)Y,X(COV
2. Overall review of Chapter 7 and 8
Discrete Probability Distributions
Continuous Probability Distributions
• Binomial distribution• Poisson Distribution
• Uniform Distribution• Normal Distribution• Standard Normal
Distribution• Exponential Distribution• t Distribution• F Distribution
Shan Huei, Wang34
Shan Huei, Wang35
3. The Binomial Distribution
The binomial experiment can result in only one of two possible outcomes.
Binomial Experiment There are n trials (n is finite and fixed). Each trial can result in a success or a failure. The probability p of success is the same for all the trials. All the trials of the experiment are independent
Binomial Random Variable The binomial random variable counts the number of successes
in n trials of the binomial experiment. By definition, this is a discrete random variable (因為數的完 ).
Shan Huei, Wang36
3. Calculating the Binomial Probability
xnxnx )p1(pC)x(p)xX(P
In general, The binomial probability is calculated by:
Mean and Variance of Binomial Variable
)!xn(!x!n
Cwhere nx
p)-np(1 s V(X)
np E(X)2
Shan Huei, Wang37
3. Binomial distribution
Binomial distribution for n = 20p = 0.1 (blue), p = 0.5 (green) and p = 0.8 (red)
Shan Huei, Wang38
Example 4
In the game of blackjack as played in casinos in Las Vegas, Atlantic City, Niagara Falls, as well as many other cities, the dealer has the advantages. Most players do not play very well. As a result, the probability that the average player wins a about 45%.Find the probability that an average player wins
a. twice in 5 hands
b. ten or more times in 25 hands
Shan Huei, Wang39
Solution
a P(X = 2) = = .3369
b Excel with n = 25 and p = .45:
P(X 10) = 1 – P(X 9) = 1 – .2424 = .7576
=BINOM.DIST(9,25,0.45,1)
2 5 25!(.45) (1 .45)
2!(5 2)!
Shan Huei, Wang40
The Poisson Random Variable (單位時間的來客數 ) The Poisson variable indicates the number of
successes that occur during a given time interval or in a specific region in a Poisson experiment
Probability Distribution of the Poisson Random Variable.
)X(V)X(E
...2,1,0x!x
e)x(p)xX(P
x
4. The Poisson Variable and Distribution
Shan Huei, Wang41
Poisson distribution
A famous quote of Poisson is: "Life is good for only two things:
Discovering mathematics and teaching mathematics."
Shan Huei, Wang42
Example 5
The number of students who seek assistance with their statistics assignments is Poisson distributed with a mean of three per day.
a. What is the probability that no student seek assistance tomorrow? (u? X?)
b. Find the probability that 10 students seek assistance in a week. (u? X?)
Shan Huei, Wang43
Solution
a. P(X = 0 with μ = 3) = =
= .0498
b. P(X = 10 with μ = 21) = =
= .0035
!x
e x
!0
)3(e 03
!x
e x
!10
)21(e 1021