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


STAT 721–W2022 Assignment 1


1. Assignment 1 problems [not for grading]

Assignment 1 contains 13 problems from Chapter 1:  1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 1.10, 1.12, 1.13, 1.14, 1.15, 1.16, 1.17, and the following simulaiton problem(s).  Only submit the  simulation  problem(s)  for  grading.   R chunks or Jupyter Notebook cells must

be included and reproducible.   To make your work reproducible, every one is asked to set the random seed in the R code using set.seed(2022) and in the Python code using import  random;  random.seed(2022).  Students can use this Rmd code as a template to typeset their solutions to the assignments. Both Rmd and its pdf or ipynb and its pdf are required in submission to D2L Dropbox.

 

2.   Instruction  to  Rstudio  and  Jupyter  Notebook  for using Rmd and ipynb (IPYNB)

For simulation studies, you can use either RStudio or Jupyter Notebook for pro- gramming and writing.

RStudio is a free and open-source integrated development environment (IDE) for R, a programming language for statistical computing and graphics. RStudio was founded by JJ Allaire, creator of the programming language ColdFusion. Hadley Wickham is the Chief Scientist at RStudio.

RStudio is available in two editions: RStudio Desktop, where the program is run locally as a regular desktop application; and RStudio Server, which allows accessing RStudio using a web browser while it is running on a remote Linux server. Prepackaged distributions of RStudio Desktop are available for Windows, macOS, and Linux.

RStudio is partly written in the C++ programming language. The bigger percentage of

the code is written in Java.

The Jupyter Notebook is an open-source web application that allows data scientists to create and share documents that integrate live code, equations, computational output, visualizations, and other multimedia resources, along with explanatory text in a single document.

Jupyter is not included with Python, so if you want to try it out, you will need to install Jupyter. There are many distributions of the Python language. You can use Anaconda to install it.

If you use Rmd in Studio, you need to submit both Rmd and pdf; if you use ipynb (IPYNB) in Jupyter, you need to submit both ipynb and pdf.  To get pdf from Rmd, you can knit it; to get pdf from ipynb, you can use File -> Download as -> PDF via LaTex.

An IPYNB  (ipynb) file is a notebook document created by Jupyter Notebook, an interactive computational environment that helps scientists manipulate and analyze data using Python. It contains all the content from a Jupyter Notebook web application session, including computation inputs and outputs, mathematical functions, images, and explanatory text.  IPYNB files can be exported to the .HTML, .PDF, reStructuredText, and LaTeX formats.

 

3.  Simulation problem [for grading, 5 marks]

In Section 1.6.3, we studied non-model-based comparison of MOM and MLE. Suppose

X1 , . . . , Xn  i.i.d. with E [Xi] = µ and E [Xi(4)] < &,

where µ > 0 is unknown. Assume

Var [Xi] = σ 2  = µ2  = c2 µ2 ,

where c = σ/µ is the coefficient of variation. The two estimators of µ are

MOM  = 

and

2 + 4c2m 

2c2                        .

(1)

Thus the ARE of MLE to MOM is ARE (MLE , MOM ) =

Do the following:

(1 + 2c2 )2                               

1 + 2c2 + 2c(Skew) + c2 (Kurt - 3) .

(1)  Generate random samples from N (µ = 1, σ2  = 4) corresponding to c = 2 and from Exponential(µ = 2) and thus variance σ 2  = 4 correponding to c = 1, respectively, then

reproduce Figure 1.2 (see page 19 of the textbook). That is, for each of Nsim = 10, 000 generated samples from each distribution and sample size, the estimator MLE  was calculated and the sample variance computed and multiplied by n. Multiplying variance by n allows us to keep results for various value of n on the same plot.  Denote the plotted points from Monte Carlo variance estimates for n = 20 by + and for n = 100 by 』.

(2) To compare the asymptotic ARE (MLE , MOM ) and the estimated ARE based on 10,000 Monte Carlo samples, consider the following two cases under σ 2  = c2 µ2 :

a.  Samples are generated from normal population N(µ = 1, σ2  = 4), where Skew = 0 and Kurt = 3.

b.  Samples are generated from Exponential(µ = 2) (heavy-tailed), where Skew = 2 and Kurt = 9.

Make a lot similar to Figure 1.2 for different n and c values, i.e., plot and asymptotic ARE and estimated ARC versus c in the same figure, using n = 20, 100, and c values between [0.5, 2].

Using two different R chunks or Python cells for (1) and (2), it can start as the folloing:

# Simulation program for  comparing  Avar  and ARE;

set.seed(2022)        #Random  seed;

n.seq=c(20 ,  100)                         #Sample  size;

Nsim=10000                                    #Simulation  times;

c.seq=c(0.5 ,  1 ,  1.5 ,  2.0) mu.norm=1;  sigma=2

mu.exp=2

#True parameter  values  for  normal;          #True parameter  values  for  exponential;

Then answer the following questions.

Note: the answers should be written in paragraphs with commnentaries and details, they cannot be hidden or mixed within R or Python commands in the program. The R or Python code is only used to check the reproducibility and is not used for answers.

(1). For comparing the asymptotic variance and the estimated variance based on Monte Carlo replications, are the two variances close? Discuss it based on different n and c values.

(2). For comparing the asymptotic variance ARE and the estimated ARE based on Monte Carlo replications, are the two AREs close? Discuss it based on different n and c values.