Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

STAT0002 Exercises 7: peer assessment

Deadline: 18:00 Thursday 1st December

These exercises will be used for the Peer assessment activity that contributes 10% your final mark for

STAT0002. Please see theAssessment instructionsfor details.

If you do not submit work for Exercises 7 before the deadline then you will be awarded no credit. If    you do not complete all 3 stages of the peer assessment before their deadlines then you will receive a mark of 0.

Please treat these exercises like the previous exercises that you have done and prepare your answers in one PDF file. Please make sure that your create your PDF file in a way avoids the problems     that some students had at the start of the term, where their text/handwriting disappeared        after submission.

Do not put your name or your student ID number anywhere in your PDF file.

Question

Suppose that, for some unknown parameter e > 0, X1, … , Xn   i. .   U(0, e), that is, X1, . . . , Xn are a     random sample from a (continuous) uniform distribution on the interval (0, e). You are given that E(Xi ) = e/2 and var(Xi ) = e 2 /12, for i = 1, . . . , n. Suppose that n > 1.

1. The estimator T1 of e

Consider the estimator T1  =  1 Xi .

(a) Find E(T1).

(b) Find var(T1).

(c) Find MSE(T1).

2. The estimator T2 of e

Consider the estimator T2  = X(n), where X(n)  = max(X1, . . . , Xn ) is the largest of X1, . . . , Xn . You are given that E(X(n)) =  e and var(X(n)) =  e 2 .

(a) Find E(T2).

(b) Find var(T2).

(c) Find MSE(T2).

3. Comparing T1 and T2

Based on your answers to parts 1 and 2, which of the estimators would you prefer? Explain your reasoning.

4. Consistency of T1 and T2

Which of the estimators T1 and T2 is consistent for e? Explain your reasoning.

5. The estimator T3

Consider the estimator T3  = T2  + 1010 /n. Show that T3 is a consistent estimator of e. Explain why we would not want to use this estimator in practice.

6. Simulation using R

We can compare the sampling distributions of T1 and T2 by simulating a sample of size n from a U(0, e) distribution, calculating and storing the values of the estimates produced by T1 and T2 and repeating this a large number (nsim) of times. In the following, we use e = 4, n = 10 and nsim  =     10,000.

If you have have not done so already then

1.     install R fromCRAN, and

2.     install (the free version of)RStudio.

Then open RStudio and copy, paste the following lines of code into the R Console and press return. (If you get an error message then try copying each of the 3 lines individually, pressing return each time.)

link <- url("https://raw.githubusercontent.com/paulnorthrop/stat0002/master/ex7sim.R") source(link, echo = TRUE)

close(link)

You should see the following.

> # The function ex7sim()

> # 1. simulates nsim samples of size n from a U(0, theta) distribution > # 2. calculates the observed value of estimators .... [TRUNCATED]

> # Set a random number seed (Exercises 7 deadline: 1/12/2022)

> # Call ex7sim() to do the simulation

> set.seed(1122022)

> simvals <- ex7sim()

> # Look at the first 5 rows of simvals

> head(simvals)

T1

[1,] 4.504053 [2,] 2.975557 [3,] 3.977911 [4,] 5.368312 [5,] 3.171625 [6,] 3.491454

T2

4.058694

3.286614

3.848054

4.236256

4.207208

4.221254

A 10,000 by 2 matrix called simvals has been created in your workspace. The 1st column, accessed using simvals[, 1] contains 10,000 estimates of e(= 4) using the estimator T1 . The 2nd column,   accessed using simvals[, 2] contains 10,000 estimates of e using the estimator T2 .

(a)   Produce 2 histograms, one of simvals[, 1] and one of simvals[, 2], to compare the

sampling distributions of T1 and T2 . Include in your answers the R code that you have used to produce the plots.

(b)   Comment on the appearance of these histograms, including comments that relate to the

theoretical comparison that you made in part 3.