User Tools

Site Tools


b:head_first_statistics:estimating_populations_and_samples

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
b:head_first_statistics:estimating_populations_and_samples [2024/11/06 08:05] – [Expectation of samples proportions (Ps)] hkimscilb:head_first_statistics:estimating_populations_and_samples [2025/11/03 09:29] (current) – [What about variance] hkimscil
Line 11: Line 11:
  
  
-<WRAP info 70%>+<WRAP box>
 $\hat\mu$ : See this hat I’m wearing? It means I’m a point estimator. If you don’t have the exact value of the mean, then I'm the next best thing. $\hat\mu$ : See this hat I’m wearing? It means I’m a point estimator. If you don’t have the exact value of the mean, then I'm the next best thing.
  
Line 88: Line 88:
 p = 32/40 = 0.8 p = 32/40 = 0.8
  
-<WRAP info 60%>+<WRAP box>
 Mighty Gumball takes another sample of their super-long-lasting gumballs, and finds that in the sample, 10 out of 40 people prefer the pink gumballs to all other colors. What proportion of people prefer pink gumballs in the population? What’s the probability of choosing someone from the population who doesn’t prefer pink gumballs? Mighty Gumball takes another sample of their super-long-lasting gumballs, and finds that in the sample, 10 out of 40 people prefer the pink gumballs to all other colors. What proportion of people prefer pink gumballs in the population? What’s the probability of choosing someone from the population who doesn’t prefer pink gumballs?
 </WRAP> </WRAP>
Line 176: Line 176:
   * random 하게 1000번의 (k=1000) 샘플링을 해서    * random 하게 1000번의 (k=1000) 샘플링을 해서 
   * 얻는 Red gumball의 숫자   * 얻는 Red gumball의 숫자
 +
 <code> <code>
-> set.seed(101)+# set.seed(101) 
 +k <- 1000 
 +n <- 100 
 +p <- 1/4 
 +q <- 1-p 
 +# in order to clarify what we are doing 
 +# X~B(n,p) 일 때, 100개의 검볼을 샘플링해서  
 +# red gumball을 세봤더니 
 +rbinom(1,n,p) # 24개 였다라는 뜻  
 + 
 +# 아래는 이것을 1000번 (k번) 한 것 
 +numbers.of.red.gumball <- rbinom(k, n, p) 
 +head(numbers.of.red.gumball) 
 + 
 +# 아래처럼 n으로 (100개의 검볼이 총 숫자이므로)  
 +# 나눠주면 비율을 구할 수 있다 
 +proportions.of.rg <- numbers.of.red.gumball/
 +ps.k <- proportions.of.rg 
 +head(ps.k) 
 + 
 +mean.ps.k <- mean(ps.k) 
 +mean.ps.k 
 +hist(ps.k) 
 + 
 + 
 +#### 
 +# set.seed(101) 
 +k <- 1000000 
 +n <- 100 
 +p <- 1/4 
 +q <- 1-p 
 +numbers.of.red.gumball <- rbinom(k, n, p) 
 + 
 +# 아래처럼 n으로 (100개의 검볼이 총 숫자이므로)  
 +# 나눠주면 비율을 구할 수 있다 
 +proportions.of.rg <- numbers.of.red.gumball/
 +ps.k <- proportions.of.rg 
 +mean.ps.k <- mean(ps.k) 
 +mean.ps.k 
 + 
 +# variance? 
 +var.cal <- var(ps.k) 
 +var.cal 
 +var.value <- (p*q)/n 
 +var.value 
 + 
 +# standard deviation  
 +sd.cal <- sqrt(var.cal) 
 +sd.cal 
 +sd.value <- sqrt(var.value) 
 +sd.value  
 + 
 +se <- sd.value  
 +# 우리는 standard deviation of sample 
 +# proportions을 standard error라고 부른다 
 + 
 +# 위의 histogram 에서 mean 값은 이론적으로 
 +
 +# standard deviation값은  
 +se 
 + 
 +qnorm(.975) 
 +# 우리는 평균값에서 +- 2*sd.cal 구간이 95%인줄 안다.  
 +se2 <- se * qnorm(.975) 
 +# 즉, 아래 구간이  
 +lower <- p-se2 
 +upper <- p+se2 
 +lower 
 +upper 
 + 
 +hist(ps.k) 
 +abline(v=lower, col=2, lwd=2) 
 +abline(v=upper, col=2, lwd=2) 
 + 
 +a <- pnorm(lower, mean=p, sd=se) 
 +b <- pnorm(upper, p, se) 
 +b-a 
 +lower 
 +upper 
 + 
 +# 위의 그래프가 의미하는 것은 rbinom(1, n, p) / n로  
 +# 얻은 하나의 샘플의 proportion의 (비율) 값은  
 +# 95/100 확률로 lower에서 upper사이에 있을 것이라는  
 +# 뜻 
 +rbinom(1, n, p)/n 
 +rbinom(1, n, p)/n 
 + 
 +k <- 100 
 +sa1 <- rbinom(k, n, p) / n 
 +head(sa1) 
 +sa1 < lower  
 +sa1 upper 
 +table(sa1 < lower) 
 +table(sa1 > upper) 
 + 
 +table(sa1 < lower | sa1 > upper)  
 +table(sa1 < lower | sa1 > upper) / k 
 +</code> 
 + 
 + 
 +<code> 
 +> # set.seed(101)
 > k <- 1000 > k <- 1000
 > n <- 100 > n <- 100
 > p <- 1/4 > p <- 1/4
 > q <- 1-p > q <- 1-p
-# in order to clarify what we are doing +# in order to clarify what we are doing 
-# X~B(n,p) 일 때, 100개의 검볼을 샘플링해서  +# X~B(n,p) 일 때, 100개의 검볼을 샘플링해서  
-# red gumball을 세봤더니+# red gumball을 세봤더니
 > rbinom(1,n,p) # 24개 였다라는 뜻  > rbinom(1,n,p) # 24개 였다라는 뜻 
-[1] 24 +[1] 22 
-# 아래는 이것을 1000번 (k번) 한 것+>  
 +# 아래는 이것을 1000번 (k번) 한 것
 > numbers.of.red.gumball <- rbinom(k, n, p) > numbers.of.red.gumball <- rbinom(k, n, p)
-> numbers.of.red.gumball +head(numbers.of.red.gumball) 
-   [1] 18 27 27 22 23 26 23 26 25 30 27 28 32 24 26 29 22 24 18 27 33 22 27 31 29 19 +[1] 24 23 25 20 27 30 
-  [27] 24 24 27 24 23 21 21 25 31 21 29 16 31 24 24 28 23 24 22 19 31 28 20 19 24 27 + 
-  [53] 28 24 28 27 25 27 26 29 29 26 36 29 27 16 23 30 32 22 32 26 29 29 22 18 22 27 +> # 아래처럼 n으로 (100개의 검볼이 총 숫자이므로)  
-  [79] 33 27 28 28 34 15 32 23 24 20 16 27 31 27 21 22 29 24 22 19 18 20 17 24 30 27 +> # 나눠주면 비율을 구할 수 있다 
- [105] 23 19 17 28 37 20 18 26 30 30 34 30 25 23 26 24 20 19 25 22 29 25 25 27 19 27 +> proportions.of.rg <- numbers.of.red.gumball/n 
- [131] 23 22 23 26 25 25 32 25 27 32 22 32 23 30 21 25 27 17 24 21 24 26 33 20 22 26 +> ps.k <- proportions.of.rg 
- [157] 28 25 30 33 27 30 26 23 39 23 31 18 26 27 34 25 28 31 35 28 29 32 27 31 28 25 +> head(ps.k) 
- [183] 22 23 15 22 20 26 21 22 16 23 22 31 24 27 31 21 24 26 26 22 22 34 19 30 22 28 +[10.24 0.23 0.25 0.20 0.27 0.30
- [209] 25 24 29 25 25 16 27 23 25 32 18 22 25 25 24 24 21 32 20 28 29 22 23 22 25 21 +
- [23527 22 24 29 24 22 30 22 21 17 25 23 21 27 22 22 25 22 29 24 26 32 28 20 22 22 +
- [261] 27 26 22 24 31 18 27 29 28 17 27 33 23 33 25 32 26 23 19 21 20 23 15 19 23 26 +
- [287] 27 28 23 24 35 27 30 23 25 24 31 23 20 22 22 26 21 22 26 28 26 23 21 13 29 27 +
- [313] 21 34 28 24 19 26 27 25 23 27 25 19 29 18 28 21 27 28 28 22 22 20 20 25 27 17 +
- [339] 16 27 32 23 18 28 31 29 21 27 27 30 21 25 20 25 26 30 26 21 15 29 22 21 16 25 +
- [365] 25 27 26 27 28 21 27 24 25 24 39 24 28 33 20 26 24 27 20 31 27 27 20 21 31 25 +
- [391] 22 22 30 34 27 23 21 25 20 24 29 19 30 27 33 22 29 30 22 29 26 24 18 26 36 26 +
- [417] 23 24 22 32 33 16 24 28 24 25 29 31 28 28 29 26 24 25 28 27 24 31 25 31 33 26 +
- [443] 26 24 33 28 20 23 22 23 22 30 25 25 23 27 27 23 24 28 24 28 23 22 26 30 26 27 +
- [469] 21 23 23 27 26 23 25 30 25 24 22 28 18 23 18 16 27 26 18 25 27 22 20 19 27 25 +
- [495] 31 27 22 21 24 24 26 23 23 29 27 23 25 20 21 21 27 25 22 29 28 21 21 24 27 24 +
- [521] 28 19 14 32 27 22 24 35 26 28 28 26 25 25 19 26 24 20 19 28 25 25 24 21 30 27 +
- [547] 30 20 22 26 31 26 20 20 27 25 26 18 30 20 29 16 38 26 22 29 22 30 26 19 27 24 +
- [573] 29 29 25 19 23 24 24 23 25 31 18 24 33 27 25 27 29 28 24 23 24 28 20 24 30 24 +
- [599] 21 20 25 24 24 30 22 26 23 25 21 21 24 27 18 20 22 30 25 23 27 26 23 23 28 18 +
- [625] 29 27 25 32 26 15 22 24 21 34 23 23 18 29 23 27 28 23 37 20 17 25 11 21 28 22 +
- [651] 28 25 22 25 21 18 20 27 30 24 28 23 30 31 24 23 37 19 27 32 25 27 28 29 22 26 +
- [677] 26 20 22 25 24 19 27 21 32 27 31 29 24 24 29 29 25 22 34 23 18 33 18 23 24 26 +
- [703] 18 20 23 30 28 26 34 17 33 30 32 30 22 28 19 19 23 23 20 23 21 31 30 20 24 23 +
- [729] 23 28 26 34 27 33 31 20 25 12 25 20 20 25 27 24 29 26 22 30 26 28 28 27 23 18 +
- [755] 28 22 21 27 22 26 21 22 27 24 19 27 29 37 30 27 25 30 19 22 22 28 32 22 33 26 +
- [781] 20 31 23 24 24 26 24 30 17 21 20 22 20 17 24 22 24 23 23 24 23 16 16 17 23 27 +
- [807] 29 26 16 21 34 19 25 25 28 32 17 22 26 23 23 24 22 22 14 30 25 33 26 25 31 28 +
- [833] 30 21 19 17 19 21 16 21 26 21 29 27 31 32 19 22 24 25 25 24 23 30 21 22 19 20 +
- [859] 21 20 21 28 19 26 28 26 29 28 26 21 31 32 31 22 23 25 27 26 22 27 30 24 25 23 +
- [885] 27 25 24 24 30 29 26 32 29 23 24 20 26 26 22 22 19 23 33 18 27 26 28 18 26 24 +
- [911] 24 26 27 17 26 23 27 25 32 20 22 23 25 25 24 28 20 19 22 20 22 24 17 19 22 17 +
- [937] 19 27 27 28 29 18 24 30 26 34 26 24 25 24 29 28 29 23 24 21 24 23 23 29 19 29 +
- [963] 30 33 25 30 32 23 30 27 17 20 21 24 36 21 26 30 26 25 22 21 38 21 24 21 25 21 +
- [989] 32 20 29 24 19 21 32 26 27 18 21 20+
  
 </code> </code>
-이 샘플의 평균?+그런데 교재는 이 이항분포를 비율로 (proportion) 생각하므로,은 방식으로 Red gumball의 비율로 바꿔서 보면
 <code> <code>
-set.seed(101+# 아래처럼 n으로 (100개의 검볼이 총 숫자이므로)  
-mean(rbinom(100, 100, 1/4)+# 나눠주면 비율을 구할 수 있다 
-[1] 25.28+> proportions.of.rg <- numbers.of.red.gumball/
 +> ps.k <- proportions.of.rg 
 +> head(ps.k
 +[1] 0.24 0.23 0.25 0.20 0.27 0.30
  
 </code> </code>
-그런데 위의 이야는 샘플의 숫자가 100 이 아닌 무한대라면 나타나는 평균을 한다. 실제 무한대를 새뮬래션해 볼 수는 없으므로 k를 1억으로 만들어 평균을 구해보면 아래와 같이 25가 된다. +위의 비율의 댓값을 (평균을) 구한다는 것이 교재가 하는 이야기
 <code> <code>
-set.seed(101+ 
-> mean(rbinom(100000000, 100, 1/4)) +> mean.ps.k <- mean(ps.k
-[1] 25.0001+> mean.ps.k 
 +[1] 0.25128
  
 </code> </code>
-위의 이야기를 visual하게 생각해보면 +위의 결과를 histogram으로 그려보면 
 <code> <code>
-set.seed(101) +> hist(ps.k) 
-k <- 10000 +
-n <- 100 +
-p <- 1/4 +
-q <- 1-p +
-numbers.of.red.gumball <- rbinom(k, n, p+
-head(numbers.of.red.gumball) +
-proportions.of.rg <- numbers.of.red.gumball/+
-head(proportions.of.rg) +
-mean(proportions.of.rg) +
-hist(proportions.of.rg)+
 </code> </code>
-{{:b:head_first_statistics:pasted:20241104-080847.png}}+ 
 +이는 평균이 0.25에 (p값에) 근접하는 값이 된다. 교재의 p값이 되는 것은 k가 무한대로 큰 값을 가질 때의 이야기.  
 +아래는 k를 1000번이 아닌 1000000번 (백만번일 때의 이야기). 평균비율이 좀 더 0.25에 근접하게 된다.  
 +<code> 
 +> set.seed(101) 
 +> k <- 1000000 
 +> n <- 100 
 +> p <- 1/4 
 +> q <- 1-p 
 +> numbers.of.red.gumball <- rbinom(k, n, p) 
 +> # 아래처럼 n으로 (100개의 검볼이 총 숫자이므로)  
 +> # 나눠주면 비율을 구할 수 있다 
 +> proportions.of.rg <- numbers.of.red.gumball / n 
 +> ps.k <- proportions.of.rg 
 +> mean.ps.k <- mean(ps.k) 
 +> mean.ps.k 
 +[1] 0.2500217 
 +>  
 +</code> 
 + 
 +{{:b:head_first_statistics:pasted:20241106-081710.png}} 
  
 ^ references  ^ ^ references  ^
Line 268: Line 356:
  
 ===== What about variance ===== ===== What about variance =====
 +그렇다면 위의 분포에서의 분산값은 얼마가 될까? 그리고 표준편차값은 얼마가 될까?
 \begin{eqnarray*} \begin{eqnarray*}
-Var(\text{probability of sample proportions}& = & Var(P_{s}) \\+\text{Variance of sample proportions} & = & Var(P_{s}) \\
 & = & Var\left(\frac{X}{n}\right) \\ & = & Var\left(\frac{X}{n}\right) \\
 & = & \frac {Var(X)}{n^{2}} \\ & = & \frac {Var(X)}{n^{2}} \\
 & = & \frac {npq}{n^{2}} \\ & = & \frac {npq}{n^{2}} \\
-& = & \frac {pq}{n}  +& = & \frac {pq}{n} \\
-\end{eqnarray*} +
- +
-\begin{eqnarray*}+
 \text{Standard deviation of sample proportions} & = & \sqrt{\frac{pq}{n}} \\ \text{Standard deviation of sample proportions} & = & \sqrt{\frac{pq}{n}} \\
 & = & \text{Standard error of sample proportions}  & = & \text{Standard error of sample proportions} 
 \end{eqnarray*} \end{eqnarray*}
 +우리는 위의 Standard deviation of sample proportions를 특별하게 standard error라고 부른다. 
  
-이를 종합하면, Sample proportions 들에 대한 기대값과 분산은 각각 아래와 같다 (그림 참조).+종합하면, Sample proportions 들에 대한 기대값과 분산은 각각 아래와 같다 (그림 참조).
  
 $$E(P_{s}) = p \qquad\qquad\qquad Var(P_{s}) = \displaystyle \frac{pq}{n}$$ $$E(P_{s}) = p \qquad\qquad\qquad Var(P_{s}) = \displaystyle \frac{pq}{n}$$
Line 289: Line 376:
  
 continuity correction: $$\pm \frac{1}{2n}$$ continuity correction: $$\pm \frac{1}{2n}$$
 +
 +R에서의 simulation을 계속해서 보면 
 +<code>
 +> # variance?
 +> var.cal <- var(ps.k)
 +> var.cal
 +[1] 0.001869
 +> var.value <- (p*q)/n
 +> var.value
 +[1] 0.001875
 +
 +> # standard deviation 
 +> sd.cal <- sqrt(var.cal)
 +> sd.cal
 +[1] 0.04323193
 +> sd.value <- sqrt(var.value)
 +> sd.value 
 +[1] 0.04330127
 +
 +> se <- sd.value 
 +> # 우리는 standard deviation of sample
 +> # proportions을 standard error라고 부른다
 +
 +</code>
 +위의 se는 standard deviation의 일종이므로 그 특성을 갖는다 (68, 95, 99%). 따라서 Red gumball의 비율이 1/4임을 알고 있을 때, n=100개의 gumball을 샘플링하면 (한번), red gumball의 비율은 p를 (0.25) 중심으로 위아래도 2*se 범위의 값이 나올 확률이 95%임을 안다는 것이 된다. 위에서 계산해보면; 
 +
 +<code>
 +> # 위의 histogram 에서 mean 값은 이론적으로
 +> p
 +[1] 0.25
 +> # standard deviation값은 
 +> se
 +[1] 0.04330127
 +
 +> qnorm(.975)
 +[1] 1.959964
 +> # 우리는 평균값에서 +- 2*sd.cal 구간이 95%인줄 안다. 
 +> se2 <- se * qnorm(.975)
 +> # 즉, 아래 구간이 
 +> lower <- p-se2
 +> upper <- p+se2
 +> lower
 +[1] 0.1651311
 +> upper
 +[1] 0.3348689
 +
 +> hist(ps.k)
 +> abline(v=lower, col=2, lwd=2)
 +> abline(v=upper, col=2, lwd=2)
 +
 +</code>
 +즉 아래의 그래프에서 
 +{{:b:head_first_statistics:pasted:20241106-084520.png}}
 +lower: 0.1633975와 (16.33975%) upper: 0.3366025 사이에서 (33.66025%) red gumaball의 비율이 나올 확률이 95%라는 이야기.
 +
 +위의 사실을 확인해 보는 작업으로 R에서 아래 스크립트를 돌려보면 
 +  * lower 밑으로 나오는 proportion과 \
 +  * upper 위로 나오는 proportion을 합한 갯수가 약 5%가 됨을 볼 수 있다. 
 +
 +
 +
 +<code>
 +> a <- pnorm(lower, mean=p, sd=se)
 +> b <- pnorm(upper, p, se)
 +> b-a
 +[1] 0.95
 +> lower
 +[1] 0.1651311
 +> upper
 +[1] 0.3348689
 +
 +> # 위의 그래프가 의미하는 것은 rbinom(1, n, p) / n로 
 +> # 얻은 하나의 샘플의 proportion의 (비율) 값은 
 +> # 95/100 확률로 lower에서 upper사이에 있을 것이라는 
 +> # 뜻
 +> rbinom(1, n, p)/n
 +[1] 0.29
 +> rbinom(1, n, p)/n
 +[1] 0.24
 +
 +> k <- 100
 +> sa1 <- rbinom(k, n, p) / n
 +> head(sa1)
 +[1] 0.29 0.29 0.23 0.23 0.27 0.29
 +> sa1 < lower 
 +  [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 +  [8] FALSE FALSE FALSE  TRUE FALSE FALSE FALSE
 + [15] FALSE FALSE FALSE FALSE FALSE  TRUE FALSE
 + [22] FALSE FALSE FALSE FALSE FALSE FALSE  TRUE
 + [29] FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 + [36] FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 + [43] FALSE FALSE  TRUE FALSE FALSE FALSE FALSE
 + [50] FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 + [57] FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 + [64] FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 + [71] FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 + [78] FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 + [85] FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 + [92] FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 + [99] FALSE FALSE
 +> sa1 > upper
 +  [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 +  [8] FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 + [15] FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 + [22] FALSE  TRUE FALSE FALSE FALSE FALSE FALSE
 + [29] FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 + [36] FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 + [43] FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 + [50] FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 + [57] FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 + [64] FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 + [71] FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 + [78] FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 + [85] FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 + [92] FALSE FALSE FALSE FALSE FALSE FALSE FALSE
 + [99] FALSE FALSE
 +> table(sa1 < lower)
 +
 +FALSE  TRUE 
 +   96     
 +> table(sa1 > upper)
 +
 +FALSE  TRUE 
 +   99     
 +
 +> table(sa1 < lower | sa1 > upper) 
 +
 +FALSE  TRUE 
 +   95     
 +> table(sa1 < lower | sa1 > upper) / k
 +
 +FALSE  TRUE 
 + 0.95  0.05 
 +
 +
 +
 +</code>
 + 
 +
 +그렇다면 만약에 30% 이상이 red gumball일 확률은 무엇이라는 질문이라면 
 +우리는 X ~ B(100, 1/4)에서 도출되는 
 +X ~ N(p, se^2) 에서 P(X>_0.3)을 구하는 질문이므로 
 +1-pnorm(0.295, p, se) 가 답이 되겠다. 
 +<code>
 +> # 0.3이 포함되는 구간을 continuity correction해야 하므로 
 +> 1/(2*100)
 +[1] 0.005
 +> t <- 1/(2*100)
 +> 0.3 - t
 +[1] 0.295
 +>
 +> 1-pnorm(0.295, p, se) 
 +[1] 0.1493488
 +>
 +</code>
  
 ===== Exercise ===== ===== Exercise =====
-<WRAP info 60%>+<WRAP box>
 25% of the gumball population are red. What’s the probability that in a box of 100 gumballs, at least 40% will be red? We’ll guide you through the steps. 25% of the gumball population are red. What’s the probability that in a box of 100 gumballs, at least 40% will be red? We’ll guide you through the steps.
  
Line 357: Line 599:
 ====== Sampling distribution of sample mean ====== ====== Sampling distribution of sample mean ======
  
-<WRAP info 60%>+<WRAP box>
 According to Mighty Gumball’s statistics for the population, the mean number of gumballs in each packet is 10, and the variance is 1. The trouble is they’ve had a complaint. One of their most faithful customers bought 30 packets of gumballs, and he found that the average number of gumballs per packet in his sample is only 8.5. According to Mighty Gumball’s statistics for the population, the mean number of gumballs in each packet is 10, and the variance is 1. The trouble is they’ve had a complaint. One of their most faithful customers bought 30 packets of gumballs, and he found that the average number of gumballs per packet in his sample is only 8.5.
 </WRAP> </WRAP>
Line 427: Line 669:
  
 {{:b:head_first_statistics:pasted:20191126-093924.png}} {{:b:head_first_statistics:pasted:20191126-093924.png}}
 +
 +see [[:r/sampling_distribution]]
  
 \begin{eqnarray*} \begin{eqnarray*}
Line 453: Line 697:
  
 ===== Exercise ===== ===== Exercise =====
-<WRAP info 60%>+<WRAP box>
 Let’s apply this to Mighty Gumball’s problem.  Let’s apply this to Mighty Gumball’s problem. 
  
Line 490: Line 734:
  
 </code> </code>
 +====== Recap ====== 
 +Distribution of **Sample** <fc #ff0000>**P**</fc>roportion<fc #ff0000>**s**</fc>, <fc #ff0000>$Ps$</fc>, 
 +when sampling n entities (repeatedly) from a population whose proportion is p. 
 +\begin{eqnarray*} 
 +Ps & \sim & N(p,  \frac{pq}{n}) \\ 
 +\text{hence, } \\ 
 +\text{standard deviation of} \\  
 +\text{sample proportions} & = & \sqrt{\frac{pq}{n}} 
 +\end{eqnarray*} 
 +Distribution of **Sample** <fc #ff0000>Means, $\overline{X}$</fc>  
 +when sampling a sample whose size is n from a population whose mean is $\mu$ and variance is $\sigma^2$. 
 +\begin{eqnarray*} 
 +\overline{X} & \sim & N(\mu,  \frac{\sigma^2}{n}) \\ 
 +\text{hence, } \\ 
 +\text{standard deviation of} \\  
 +\text{sample means} & = &  \sqrt{\frac{\sigma^2}{n}} \\ 
 +& = &  \frac{\sigma}{\sqrt{n}} 
 +\end{eqnarray*}
b/head_first_statistics/estimating_populations_and_samples.1730847942.txt.gz · Last modified: by hkimscil

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki