1
$\begingroup$

Suppose that $T_1,…,T_{10}$ are iid $Exp(λ)$ and the goal is to test if $H_0:λ≤1$ versus $H_a:λ≥2$. Suppose that the test statistic is $S=\sum_{i=1}^{10}T_i$, and rejection of the null occurs when $S≤7$.


I realize that $T_1...T_{10}$ is a gamma distribution of $S =Gamma(10, \lambda$), but I am not sure how to use this information to find the p-value for the type 1 error.

$\endgroup$
4
  • 1
    $\begingroup$ Does this answer your question? Finding bound for type 1 and type 2 error $\endgroup$ – B.Liu Apr 1 at 0:30
  • $\begingroup$ No, it doesn't answer the question $\endgroup$ – rabito Apr 1 at 0:35
  • 1
    $\begingroup$ Apologies, that is an artefact of flagging it as a duplicate. Please consider editing your original question, as they are quite similar as written and we prefer keeping answers for similar questions in the same page. $\endgroup$ – B.Liu Apr 1 at 0:39
  • $\begingroup$ Do not cross-post please. $\endgroup$ – StubbornAtom Apr 1 at 11:22
0
$\begingroup$

When computing the Type I error, you assume $H_0$ is true. So you are finding the $P(S \le 7 | \lambda \le 1)$. As $\lambda$ gets smaller, we expect $S$ to get larger, so $P(S \le 7 | \lambda \le 1)$ will be the largest when $\lambda = 1$. $P(S \le 7 | \lambda \le 1) \le P(S \le 7 | \lambda = 1) = P(S \sim Gamma(10, 1) \le 7) = 0.1695$

One other note, the null and alternate hypothesis normally divide the parameter space without holes. Did you mean to say $H_a: \lambda > 1$? You can compute this in R with pgamma(7, 10, 1)

Nsims <- 10000

lambda0 <- 1
n <- 10
S <- numeric(Nsims)
for (i in 1:Nsims) {
  Tn <- rexp(n, rate = lambda0) # lambda is E(exp(lambda)) = 1 / lambda
  S[i] <- sum(Tn)
}

hist(S, freq = FALSE)
lines(seq(0,30,length=1000), dgamma(seq(0,30,length=1000), n, lambda0))

#P(S < 7 | lambda0 = 1)

length(which(S <= 7)) / length(S)
#> [1] 0.1723
pgamma(7, 10, 1)
#> [1] 0.1695041
$\endgroup$
1
  • $\begingroup$ thank you! this makes so much sense. The problem actually gives me $H_a \geq 2$, but I agree, it normal should be $H_a >1$ $\endgroup$ – rabito Apr 1 at 1:12
1
$\begingroup$

You reject when $S \le 7$ where, under $H_0; \lambda \le 1,$ $S \sim \mathsf{Gamma}(10, 1),$ so the probability of Type I Error (rejecting $H_0$ when $H_0$ is true) is $\alpha = P(S \le 7\, |\, H_0) = 0.1695.$ [Computation in R, where pgamma is a gamma CDF.]

pgamma(7, 10, 1)
[1] 0.1695041

Then $\beta = P(x \ge 7\, |\, H_a) = 1 - P(S \le 7\, |\, H_a) = 0.109,$ whee $H_a: \lambda \ge 2.$

1 - pgamma(7, 10, 2)
[1] 0.1093994

In the figure below $\alpha$ is the area under the blue density curve to the left of $s = 7$ and $\beta$ is the area under the brown density curve to the right of $s=7.$

enter image description here

R code for figure:

hdr = "Density functions of GAMMA(10,1) [null, blue] and GAMMA(10,2)"
curve(dgamma(x, 10, 1), 0, 20, ylim=c(0,.3), col="blue", lwd=2,
      ylab="Density", xlab="s", main=hdr)
  curve(dgamma(x, 10, 2), add=T, col="brown", lwd=2)
  abline(v=0, col="green2");  abline(h=0, col="green2")
  abline(v=7, col="red", lwd=2, lty="dashed")
$\endgroup$
2
  • $\begingroup$ Small detail: The alternative hypothesis is a composite hypothesis. The computation for $\beta$ is the computation of the suppremum of $\beta$. The actual type II error might be smaller when $\lambda>2$. (But anyway the type II error was not asked) $\endgroup$ – Sextus Empiricus Apr 1 at 6:47
  • $\begingroup$ @SextusEmpiricus: All valid points. // Seemed incomplete without type II error and graphs. $\endgroup$ – BruceET Apr 1 at 7:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.