Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Question 3 (10 marks) A95% confidence interval for H is given by: it t 0.025 whe

ID: 3179374 • Letter: Q

Question

Question 3 (10 marks) A95% confidence interval for H is given by: it t 0.025 where tao2sis the 97.5th percentile of the t distribution with df n-1. We can use R to explore the performance of t confidence intervals across samples by simulating taking many samples from a population and calculating and saving the confidence interval for each one. Then, we can determine the empirical coverage probability of the interval estimator as the proportion of the confidence intervals that contain H In this question, you will compare empirical coverage probabilities of t confidence intervals based on SRSs of different sizes and from different populations. a. (3 marks) Complete the following table by filling in H, o and the shape of the distribution of X for each of the three populations. Be sure to show some steps, if appropriate (do this in the table). Then copy and paste the table direct into the Portal test as your answer ly Po ation (X) Normal with Discrete Uniform Gamma with a 2 and A-1 u 2 and a 1 shape

Explanation / Answer

Population(X)

Normal with mean = 2 and std. dev. = 1

Discrete Uniform over x = 1,2,3

Gamma with alpha = 2 and beta = 1

Mean

2

(a+b)/2 = (1+3)/2 = 2

Alpha/beta = 2/1 = 2

Standard Deviation

1

Sqrt((n^2-1)/12) =
sqrt((3^2 – 1)/12) = sqrt(2/3) = 0.667

Sqrt(alpha/beta^2) =
sqrt(2/1^2) = 1.414

Shape

Bell curve

rectangle

Skewed bell curve

Empirical Coverage Probabilities of 95% CI

(based on N=5000 samples)

Normal with mean = 2 and std. dev. = 1

Discrete Uniform over x = 1,2,3

Gamma with alpha = 2 and beta = 1

n = 2

0.9466

0.7732

0.9332

n = 5

0.946

0.944

0.9172

n = 25

0.952

0.9488

0.934

n = 50

0.9488

0.9514

0.941

c) The proportion of CIs that include the mean reaches 95% as the sample size increases. This is more relevant when the population distribution is not normal and are highy skewed. That is skewed distributions such as gamma requires higher number of sample size to achieve 95% coverage probability. T distribution is an appropriate test as long as the sample size is atleast 25 for discrete uniform distribution, is atleast 50 for gamma distribution and is appropriate for normal distribution for any sample size.

d)

Normal distribution
> N = 5000
> n = 2
> CIlower <- rep(0,N)
> CIupper <- rep(0,N)
> for (i in 1:N) {
+         sample <- rnorm(n,2,1)
+         xbar <- mean(sample)
+         s <- sd(sample)
+         CIlower[i] <- xbar-qt(0.975,n-1)*s/sqrt(n)
+         CIupper[i] <- xbar+qt(0.975,n-1)*s/sqrt(n)
+ }
> mean((CIlower<=2)*(CIupper>=2))
[1] 0.9466

> N = 5000
> n = 5
> CIlower <- rep(0,N)
> CIupper <- rep(0,N)
> for (i in 1:N) {
+         sample <- rnorm(n,2,1)
+         xbar <- mean(sample)
+         s <- sd(sample)
+         CIlower[i] <- xbar-qt(0.975,n-1)*s/sqrt(n)
+         CIupper[i] <- xbar+qt(0.975,n-1)*s/sqrt(n)
+ }
> mean((CIlower<=2)*(CIupper>=2))
[1] 0.946

> N = 5000
> n = 25
> CIlower <- rep(0,N)
> CIupper <- rep(0,N)
> for (i in 1:N) {
+         sample <- rnorm(n,2,1)
+         xbar <- mean(sample)
+         s <- sd(sample)
+         CIlower[i] <- xbar-qt(0.975,n-1)*s/sqrt(n)
+         CIupper[i] <- xbar+qt(0.975,n-1)*s/sqrt(n)
+ }
> mean((CIlower<=2)*(CIupper>=2))
[1] 0.952

> N = 5000
> n = 50
> CIlower <- rep(0,N)
> CIupper <- rep(0,N)
> for (i in 1:N) {
+         sample <- rnorm(n,2,1)
+         xbar <- mean(sample)
+         s <- sd(sample)
+         CIlower[i] <- xbar-qt(0.975,n-1)*s/sqrt(n)
+         CIupper[i] <- xbar+qt(0.975,n-1)*s/sqrt(n)
+ }
> mean((CIlower<=2)*(CIupper>=2))
[1] 0.9488

Uniform distribution
> N = 5000
> n = 2
> CIlower <- rep(0,N)
> CIupper <- rep(0,N)
> for (i in 1:N) {
+     sample <- sample(c(1,2,3), size = n, replace = TRUE)
+     xbar <- mean(sample)
+     s <- sd(sample)
+     CIlower[i] <- xbar-qt(0.975,n-1)*s/sqrt(n)
+     CIupper[i] <- xbar+qt(0.975,n-1)*s/sqrt(n)
+ }
> mean((CIlower<=2)*(CIupper>=2))
[1] 0.7732

> N = 5000
> n = 5
> CIlower <- rep(0,N)
> CIupper <- rep(0,N)
> for (i in 1:N) {
+     sample <- sample(c(1,2,3), size = n, replace = TRUE)
+     xbar <- mean(sample)
+     s <- sd(sample)
+     CIlower[i] <- xbar-qt(0.975,n-1)*s/sqrt(n)
+     CIupper[i] <- xbar+qt(0.975,n-1)*s/sqrt(n)
+ }
> mean((CIlower<=2)*(CIupper>=2))
[1] 0.944

> N = 5000
> n = 25
> CIlower <- rep(0,N)
> CIupper <- rep(0,N)
> for (i in 1:N) {
+     sample <- sample(c(1,2,3), size = n, replace = TRUE)
+     xbar <- mean(sample)
+     s <- sd(sample)
+     CIlower[i] <- xbar-qt(0.975,n-1)*s/sqrt(n)
+     CIupper[i] <- xbar+qt(0.975,n-1)*s/sqrt(n)
+ }
> mean((CIlower<=2)*(CIupper>=2))
[1] 0.9488

> N = 5000
> n = 50
> CIlower <- rep(0,N)
> CIupper <- rep(0,N)
> for (i in 1:N) {
+     sample <- sample(c(1,2,3), size = n, replace = TRUE)
+     xbar <- mean(sample)
+     s <- sd(sample)
+     CIlower[i] <- xbar-qt(0.975,n-1)*s/sqrt(n)
+     CIupper[i] <- xbar+qt(0.975,n-1)*s/sqrt(n)
+ }
> mean((CIlower<=2)*(CIupper>=2))
[1] 0.9514

Gamma Distribution

> N = 5000
> n = 2
> CIlower <- rep(0,N)
> CIupper <- rep(0,N)
> for (i in 1:N) {
+         sample <- rgamma(n = n, shape = 2, rate = 1)
+         xbar <- mean(sample)
+         s <- sd(sample)
+         CIlower[i] <- xbar-qt(0.975,n-1)*s/sqrt(n)
+         CIupper[i] <- xbar+qt(0.975,n-1)*s/sqrt(n)
+ }
> mean((CIlower<=2)*(CIupper>=2))
[1] 0.9332

> N = 5000
> n = 5
> CIlower <- rep(0,N)
> CIupper <- rep(0,N)
> for (i in 1:N) {
+         sample <- rgamma(n = n, shape = 2, rate = 1)
+         xbar <- mean(sample)
+         s <- sd(sample)
+         CIlower[i] <- xbar-qt(0.975,n-1)*s/sqrt(n)
+         CIupper[i] <- xbar+qt(0.975,n-1)*s/sqrt(n)
+ }
> mean((CIlower<=2)*(CIupper>=2))
[1] 0.9172

> N = 5000
> n = 25
> CIlower <- rep(0,N)
> CIupper <- rep(0,N)
> for (i in 1:N) {
+         sample <- rgamma(n = n, shape = 2, rate = 1)
+         xbar <- mean(sample)
+         s <- sd(sample)
+         CIlower[i] <- xbar-qt(0.975,n-1)*s/sqrt(n)
+         CIupper[i] <- xbar+qt(0.975,n-1)*s/sqrt(n)
+ }
> mean((CIlower<=2)*(CIupper>=2))
[1] 0.934

> N = 5000
> n = 50
> CIlower <- rep(0,N)
> CIupper <- rep(0,N)
> for (i in 1:N) {
+         sample <- rgamma(n = n, shape = 2, rate = 1)
+         xbar <- mean(sample)
+         s <- sd(sample)
+         CIlower[i] <- xbar-qt(0.975,n-1)*s/sqrt(n)
+         CIupper[i] <- xbar+qt(0.975,n-1)*s/sqrt(n)
+ }
> mean((CIlower<=2)*(CIupper>=2))
[1] 0.941

Population(X)

Normal with mean = 2 and std. dev. = 1

Discrete Uniform over x = 1,2,3

Gamma with alpha = 2 and beta = 1

Mean

2

(a+b)/2 = (1+3)/2 = 2

Alpha/beta = 2/1 = 2

Standard Deviation

1

Sqrt((n^2-1)/12) =
sqrt((3^2 – 1)/12) = sqrt(2/3) = 0.667

Sqrt(alpha/beta^2) =
sqrt(2/1^2) = 1.414

Shape

Bell curve

rectangle

Skewed bell curve

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote