In [49]:
source("../R/functions.R")

In [50]:
obs = observation(n = 20, S = 379.7231, USS = 7209.525)

In [51]:
printSingleObservation(obs)


$ f = n - 1 = 19 $
$ SSD = USS - S^2 = 0.0433663194999099 $
Estimeret middelværdi
$ \mu \leftarrow \bar{x}. = \frac{S}{n} = \frac{379.7231}{20} = 18.986155 \sim\sim N(\mu, \frac{\sigma^2}{n}) $
$ StdError = \sqrt{s^2 / n} = \sqrt{0.00228243786841631 / 20} = 0.0106827849094146 $
95% konfidensinterval for $\mu$
$ c_{95}(\mu) = \bar{x.} \mp t_{0.975}(f) StdError = 18.986155 \mp 0.0223593257834748 = [18.9637956742165; 19.0085143257835] $
Estimeret varians
$ \sigma^2 \leftarrow s^2 = \frac{SSD}{f} = \frac{0.0433663194999099}{19} = 0.00228243786841631 \sim\sim \sigma^2 \chi^2 (n-1) / (n - 1) $
Estimeret spredning
$ \sigma \leftarrow s = \sqrt{s^2} = 0.0477748664929198 $
Konfidensinterval for $\sigma^2$
$ c_{95}(\sigma^2) = [\frac{f s^2}{\chi^2_{0.975}(f)}, \frac{f s^2}{\chi^2_{0.025}(f)}] = [0.0013200379894682, 0.00486905510000587] $

In [48]:
printTestMeanHypothesis(obs, 19)


Tester hypotese om middelværdi

Vi laver en $t$-test.
$ H_0: \mu = \mu_0 = 19 $
$ t $-teststørrelsen bliver
$ t(x) = \frac{\bar{x}. - \mu_0}{\sqrt{s^2 / n}} = \frac{18.986155 - 19}{\sqrt{0.00228243786841631 / 20}} = -1.29601036783943 $
testsandsynligheden bliver
$ p_{obs}(x) = 2(1 - F_{t(n-1)}(| t(x) |)) = F_{f(19)}(|t(-1.29601036783943)|)) = 1.78950517670509 $
Da $p_{obs}(x)$ er større end $0.05$ kan hypotesen ikke forkastes.

In [ ]: