HW2

Problem 1

Let \(X_1\), \(X_2\), \(X_3\), … , \(X_n\) be i.i.d exponential random variables with mean \(\theta\).

  1. One possible estimator for \(\theta\) is \(\overline X\). Recall that the variance of \(X_i\) is \(\theta^2\), so we can estimate \(Var(X_i)\) as \((\overline X) ^2\). By using these estimators for the mean and variance, write down the asymptotic (i.e., large sample) confidence interval for \(\theta\) with the confidence level \(1 - \alpha\). (Note that you should use \(\overline X ^2\) as the variance estimator, not \(S^2\).)

Solution: \[ \Big( \ldots \Big), \]

  1. Set \(n = 4\), \(\theta = 2\), \(\alpha = 0.1\). Generate a vector \(x\) that contains the random sample \(X_1\), … , \(X_n\) and calculate the bounds of the asymptotic confidence interval which you wrote in 1. (Be careful with the generation of exponential r.v.s in R, since R functions for these random variables use parameter “rate” = \(1/\theta\).) Does this interval contain \(\theta\)?

Solution:

set.seed(123)
# n = 
# theta = 
# alpha = 
# x = rexp(...)
#now calculate the lower and upper bounds of the confidence interval (lb, ub):
# lb = ... 
# lb
# ub =  ...
# ub

Comment: \(\ldots\)

  1. Repeat the calculation that you programmed for 2. for \(N = 10,000\) times and record whether the CI contained \(\theta\) in a vector of length \(N\). What is the proportion of the cases when \(\theta\) lies inside the interval? Comment on your results: What can you say about the performance of the asymptotic CI? Why does this happen?

Solution:

N = 10000
y = rep(0, N) #pre-fill y with zeros.
#for (i in 1:N){
#  ... #generate a sample and calculate the lower and upper bounds of the CI.
#  if (... && ...){ #if theta is between bounds, set y[i] to 1.
#    y[i] = ...
#  }
#}
# finally, calculate the mean of y
#  ...

Comment: \(\ldots\)

  1. Change \(n\) to \(n = 40\) and repeat 3. Comment on your results.

Solution:

#n = ...
#y = rep(...)
#for (...){
# ....   
#  if (...){
#    y[i] = ...
#  }
#}
# calculate the mean of y
# ...

Comment: \(\ldots\)