경영통계분석 과제3

Question 1

if \(X_1,\;X_2,\;...\;,\;X_n\) are i.i.d random variables with mean \(\mu\) and variance \(\sigma^2\), calculate the covariance \(\bar{X}\) and \(X_i-\bar{X}\) for any \(i=1,\,...\,,n\).

Answer

먼저, 임의의 확률변수 \(U, V\)에 대하여 \(Cov(U,V)=E[(U-E[U])(V-E[V])]=E[UV]-E[U]E[V]\) 입니다.

\(\bar{X}=\frac{1}{n}\sum_{i=1}^n X_i\Rightarrow E[\bar{X}]=\mu,\;E[X_i-\bar{X}]=0\;for\;all\;i\)이고, 각각의 \(X_i\)는 독립이므로 \(E[X_iX_j]=E[X_i]E[X_j]=\mu^2\;for\;i\neq j\)이며, \(E[X_i^2]=Var[X_i]+E[X_i]^2=\sigma^2+\mu^2\)입니다.

이를 이용하면 \(E[\bar{X}^2]=E[\frac{\sum_i X_i^2+\sum_{i,j}^{i\neq j}X_iX_j}{n^2}]=\frac{n(\sigma^2+\mu^2)+n(n-1)\mu^2}{n^2}=\frac{n\sigma^2+n^2\mu^2}{n^2}=\frac{\sigma^2}{n}+\mu^2\)입니다.

이제 공분산을 구해보겠습니다.

\[Cov[\bar{X},X_i-\bar{X}]=E[\bar{X}(X_i-\bar{X})]-\mu\times 0=E[\bar{X}X_i]-E[\bar{X}^2]\]

\[=\frac{E[X_i(X_1+...+X_n)]}{n}-\frac{\sigma^2}{n}-\mu^2=\frac{E[X_i^2]+(n-1)\mu^2-\sigma^2-n\mu^2}{n}\]

\[=\frac{\sigma^2+\mu^2-\mu^2-\sigma^2}{n}=0\]

즉, 공분산은 0입니다.

간결한 풀이방법

\(Cov[X_i,X_j]=0\;for\;i\neq j,\;Cov[X_i,X_i]=Var[X_i]=\sigma^2,\;Var[\bar{X}]=\frac{\sigma^2}{n}\)이므로,

\(Cov[\bar{X},X_i-\bar{X}]=Cov[\bar{X},X_i]-Cov[\bar{X},\bar{X}]=\frac{Var[X_i]}{n}-Var[\bar{X}]=0\)

Question 2

A commercial for a manufacturer of household appliance claims that 3% of all its product require a service call in the first year. A consumer protection association wants to check the claim by surveying 400 households that recently purchased one of the company’s appliances. What is the probability that more than 5% require a service call within the first year?

  1. Calculate the probability using the approximate normal approach.

  2. Calculate the probability using the binomial distribution.

Answer

각각의 가구를 조사하는 일은 독립이며, 클레임이 있는 경우를 1, 없는 경우를 0으로 나누면 이는 \(Ber(0.03)\)의 베르누이시행입니다.

이를 400번 반복하므로 분포는 \(B(400,0.03)\)의 이항분포이며, 정규분포로 근사하면 아래와 같습니다.

\[By\;CLT,\;\frac{\sum_{i=1}^{400}(X_i-0.03)}{\sqrt{400}\sqrt{0.03\times 0.97}}\sim N(0,1)\Rightarrow X\sim N(12,11.64)\;for\;X\sim B(400,0.03)\]

클레임이 있는 가구가 5%를 초과할 확률은 20가구를 초과할 확률 \(P(X>20)\)이므로, (a) 0.95% 및 (b) 1.05%입니다.

정규분포 근사는 n이 매우 크고 p가 0.5와 인접할 때 정확도가 높은데, n은 충분히 크지만 p가 매우 작아 다소 오차가 발생하는 것으로 추정됩니다.

# (a) normal dist.
1-pnorm(20,12,sqrt(11.64))
[1] 0.009517584
# (b) binomial dist.
prob=0
for(i in 0:20){
    prob=prob+choose(400,i)*0.03^i*0.97^(400-i)
}
1-prob
[1] 0.01045374

Question 3

Suppose that \(X\) has normal dist. with \(\mu=10,\;\sigma=2\)

(a) \(P(6<X<14)\) : 0.9545

mean=10; std=2
pnorm(14,mean,std)-pnorm(6,mean,std)
[1] 0.9544997
Note

이는 \(P(X\in (\mu-2\sigma,\mu+2\sigma))\)이므로, 95.45%임이 잘 알려져있습니다.

(b) \(P(X\leq c)=0.95\) : c=13.29

# (a) P(X<=c)=0.95, Using bisection method
i <- mean-3*std
j <- mean+3*std
mid <- (i+j)/2
while(abs(pnorm(mid,mean,std)-0.95)>0.000001){
  if(pnorm(mid,mean,std)-0.95>=0){j <- mid}
  if(pnorm(mid,mean,std)-0.95<0){i <- mid}
  mid=(i+j)/2
}
paste(j,pnorm(j,mean,std),sep=" / ")
[1] "13.2897644042969 / 0.950002947051978"

(c) for sample \({X_1,...,X_4}\), \(P(\bar{X}\leq 12)\) : 0.9772

\(E(\bar{X})=10,\;Var(\bar{X})=\frac{4}{4}=1\)이고, 각각의 \(X_i\)는 i.i.d 정규분포이므로 \(\bar{X}\sim N(10,1)\)입니다.

pnorm(12,10,1)
[1] 0.9772499

Question 4

Bits are sent over a communications channel in packets of 160. If the probability of a bit being corrupted (one error) over this channel is 0.2 and such errors are independent. Let X denotes the number of bits that are corrupted over this channels

  1. What is the distribution of X? Can it be approximated as normal distribution?
  2. Approximately, what is the probability that more than 50 bits in a packet are corrupted?

Answer

한번의 전송에 에러가 발생하는 경우를 1, 아닌 경우를 0으로 나누면 이는 확률 0.2의 베르누이 시행입니다. 이를 160번 반복하고 에러가 발생하는 횟수인 \(X\)\(B(160,0.2)\) 이항분포를 따를 것 입니다.

해당 이항분포는 시행횟수가 충분히 크지만(>30), 확률이 0.2로 다소 낮아 정규분포 \(N(32,25.6)\)를 사용할 때 근소한 오차가 발생할 수 있습니다.

\(P(X>30)\)을 구해보면,정규분포는 34.63%, 이항분포는 39.05%으로 오차가 다소 존재하므로 이에 유의해야합니다.

prob=0
for(i in 0:30){
    prob=prob+choose(160,i)*0.2^i*0.8^(160-i)
}
paste(pnorm(30,32,sqrt(25.6)),prob,sep=" / ")
[1] "0.34631639202098 / 0.390465138866041"

에러가 50번을 초과하여 발생할 확률은 \(P(X>50)\)이므로, 정규분포를 이용한 확률은 0.0187%입니다. 한편, 이항분포를 이용한 확률은 0.0265%입니다.

prob=0
for(i in 0:50){
    prob=prob+choose(160,i)*0.2^i*0.8^(160-i)
}
paste(1-pnorm(50,32,sqrt(25.6)),1-prob,sep=" / ")
[1] "0.000187156123554355 / 0.000264520708086802"

Question 5

A large population is described by the probability distribution, Let \(X_1\) and \(X_2\) be a random sample of size2 from the distribution.

X f(x)
0 0.1
1 0.2
2 0.7
  1. Determine the sampling distribution of \(max(X_1,X_2)\)
  2. Determine the sampling distribution of \(X_1+X_2\)

Answer

먼저 \(X_1,X_2\)는 모집단으로부터 추출한 표본으로 i.i.d를 만족할 것 입니다. 따라서 \(f(X_1=x_1,X_2=x2)=f(x_1)f(x_2)\)로 산출할 수 있습니다.

\(x_m\in\{0,1,2\}\;for\;x_m\sim max(X_1,X_2)\)이고, 순서쌍 \((x_1,x_2)\)로 경우의 수를 나타내면 \((0,0)\Rightarrow x_m=0\)\((0,1),\,(1,0),\,(1,1)\Rightarrow x_m=1\)\((2,0),\,(2,1),\,(2,2),\,(0,2),\,(1,2)\Rightarrow x_m=2\)입니다. 따라서, \(max(X_1,X_2)\)의 분포는,

\(x_m\) \(max(X_1,X_2)\)
0 0.01
1 0.02+0.02+0.04=0.08
2 0.7+0.21=0.91

위와 유사한 방법으로 \(X_1+X_2\)의 경우의 수를 나타내면 다음과 같습니다.

\(x_1\in X_1\) \(x_2\in X_2\) \(\Rightarrow\) \(x_+\in X_1+X_2\)
0 0 0
0 1 1
1 0 1
1 1 2
2 0 2
0 2 2
1 2 3
2 1 3
2 2 4

따라서, \(X_1+X_2\)의 분포는,

\(x_+\) \(X_1+X_2\)
0 0.01
1 0.02+0.02=0.04
2 0.04+0.07+0.07=0.18
3 0.14+0.14=0.28
4 0.49