Quiz 7

Quiz 7 (15 minutes)

Suppose that you observe an IID random sample \(\{X_t\}_{t=1}^n\) of size \(n=5\) from \(\mathsf{Unif}\left[1,\alpha\right]\), where \(\alpha\in\mathbb{R}\) and \(\alpha>1\).

Below you will find an observed sample of size \(n=5\):

## [1] 2.41 2.27 1.28 1.75 1.90

Answer the following questions given the information above:

Suggested solution

\[ \begin{eqnarray} \mathbb{E}\left(X_t-\frac{1+\alpha}{2}\right) &=& 0 \\ \mathbb{E}\left(X_t^2-\frac{\alpha^2+\alpha+1}{3}\right) &=& 0 \end{eqnarray} \]

To show that these two moment conditions hold, you have to calculate

\[ \mathbb{E}\left(X_t\right)=\int_1^{\alpha} t \cdot \frac{1}{\alpha-1} \,\,dt \qquad \mathbb{E}\left(X_t^2\right)=\int_1^{\alpha} t^2 \cdot \frac{1}{\alpha-1} \,\,dt \]

Suggested solution, continued

\[\frac{1}{n}\sum_{t=1}^n X_t - \frac{1+\widehat{\alpha}}{2}=0.\]

An estimate of \(\alpha\) based on the data is \(2*(1.922)-1=2.844\).

Suggested solution, continued

Remarks on submitted solutions

Implementing GMM

GMM, R version

# Create GMM criterion function
# Weighting matrix is identity matrix
gmm.obj <- function(alpha)
{
  # Draw random numbers from uniform
  x <- runif(5, 1, 3)
  # Setup the GMM objective function
  return((sum(x)-(1+alpha)/2)^2+(sum(x^2)-(alpha^2+alpha+1)/3)^2)
}
# Command to find minimizers/maximizers
# Valid for one-dimensional problems only
# Minimize is the default
# c(1, 100) is the interval [1,100]. This is to tell
# optimize where to search for a minimizer.
optimize(gmm.obj, c(1,100))
## $minimum
## [1] 8.46
## 
## $objective
## [1] 102
# $minimum is the minimizer
# $objective is the smallest value of the objective function

GMM, R version, continued