State the fundamental question of inference.
How does what we observed compare to what would happen if the null hypothesis (\(H_0\)) were true and we repeat the process many times?
On paper (lots of latex that I don’t want to mess up). Assume a sample size of 25 from an exponential with a \(\lambda\) of \(\frac{1}{5}\).
What are the theoretical values for \(E(X)\), \(E(\hat{X})\), \(Var(X)\), and \(Var(\hat{X})\)?
expected_function <- function(x){(x/5 * (exp(-x/5)))}
expected <- integrate(expected_function, 0, Inf)$value
var_funct <- function(x){(((x - expected)^2) * 1/5 * exp(-x/5))}
variance <- integrate(var_funct, 0, Inf)$value
variance_bar_funct <- function(x){(((x - expected)^2) * 1/5 * exp(-x/5))}
variance_bar <- integrate(var_funct, 0, Inf)$value/25
The Theoretical value for \(E(X)\) = \(\mu_X\). This means that the theoretical expected value is 5.
The Theoretical value for \(E(\hat{X})\) = \(\mu_\hat{X}\) = \(\mu_X\). This means that the theoretical expected value is 5.
The Theoretical value for \(Var(X)\) = \(\theta_{X}^{2}\). This means that the theoretical variance is 25.
The Theoretical value for \(Var(\hat{X})\) is \(\frac{\theta_{\hat{X}}^{2}}{n}\) = \(\frac{\theta_{X}^{2}}{n}\). This means that the theoretical variance is 1.
Question on page (didn’t want to latex it out again).
sims <- 10^4
x_hat <- numeric(sims)
for (i in 1:sims) {
x_hat[i] <- mean(rexp(25, 1/5))
}
expected_value <- mean(x_hat)
variance <- var(x_hat)
\(E(\hat{X})\) is 4.99, \(Var(\hat{X})\) is 0.98784.
From your simulation, find the probability that \(\hat{X} \geq 7\).
prob_x_hat <- sum(x_hat >= 7)/sims
The probability that \(\hat{X} \geq 7\) is 0.0314.