Confidence Interval

Proporsi populasi

\[ \mathrm{SD} (\hat{p}) = \sqrt{\frac {p (1 - p)} {n}} \]

\[ -1.96 \cdot \mathrm{SD} (\hat{p}) < \hat{p} - p < 1.96 \cdot \mathrm{SD} (\hat{p}) \]

\[ \mathrm{SE} (\hat{p}) = \sqrt{\frac {\hat{p} (1 - \hat{p})} {n}} \]

\[ \frac {\hat{p} - p} {\mathrm{SE} (\hat{p})} = \frac {\mathrm{observed} - \mathrm{expected}} {\mathrm{SE}} \]

\[ -1.96 \cdot \mathrm{SE} (\hat{p}) < \hat{p} - p < 1.96 \cdot \mathrm{SE} (\hat{p}) \]

\[ \hat{p} - 1.96 \cdot \mathrm{SE} (\hat{p}) < p < \hat{p} + 1.96 \cdot \mathrm{SE} (\hat{p}) \]

wvs |> 
  count(kota_desa)
# A tibble: 2 × 2
  kota_desa     n
  <chr>     <int>
1 Pedesaan   2098
2 Perkotaan   785
x <- 785
n <- 2098 + 785
p_hat <- x / n
p_hat
[1] 0.2722858
alpha <- 1 - 0.95
z_star <- qnorm(1 - alpha / 2)
z_star
[1] 1.959964
se <- sqrt(p_hat * (1 - p_hat) / n)
se
[1] 0.008290307
c(lower = p_hat - z_star * se,
  upper = p_hat + z_star * se)
    lower     upper 
0.2560371 0.2885345 
prop.test(x, n)

    1-sample proportions test with continuity correction

data:  x out of n, null probability 0.5
X-squared = 597.07, df = 1, p-value < 2.2e-16
alternative hypothesis: true p is not equal to 0.5
95 percent confidence interval:
 0.2561781 0.2890060
sample estimates:
        p 
0.2722858 

Rata-rata populasi

\[ Z = \frac {\bar{x} - \mu} {\sigma \mathbin{/} \sqrt{n}} = \frac {\bar{x} - \mu} {\mathrm{SD} (\hat{x})} \]

\[ T = \frac {\bar{x} - \mu} {s \mathbin{/} \sqrt{n}} = \frac {\bar{x} - \mu} {\mathrm{SE} (\bar{x})} = \frac {\mathrm{observed} - \mathrm{expected}} {\mathrm{SE}} \] \[ P \left( -t ^* < \frac {\bar{x} - \mu} {\mathrm{SE} (\bar{x})} < t ^* \right) = 1 - \alpha \]

\[ P \left( \bar{x} - t ^* \cdot \mathrm{SE} < \mu < \bar{x} + t ^* \cdot \mathrm{SE} \right) = 1 - \alpha \]

\[ \bar{x} \pm t ^* \mathrm{SE} (\bar{x}) \]

xbar <- 66
s <- 4
n <- 30
alpha <- 1 - 0.95
t_star <- qt(1 - alpha / 2, df = n - 1)
se <- s / sqrt(n)
moe <- t_star * se
xbar + c(-1,1) * moe
[1] 64.50638 67.49362

One-sided

Variansi populasi

Selisih nilai

Proporsi

Rata-rata

Matched samples

Median

Distribusi binomial

Signed-rank statistic

Rank-sum statistic