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

STAT4CI3/6CI3 Computational Methods for Inference

STATISTICS 4CI3/6CI3

FALL 2022

FINAL EXAM

Q. 1    a)  [10 marks]

Write an efficient R function to generate a random sample from the distribution with probability mass function

f (x)  =   { 0.2}x0

Verify that your function does indeed generate a sample from this distribution.

b)  [10 marks]

Consider the following R function

rLaplace  <-  function(N ,  rate=1)  桂

if  (rate  <=  0)  stop("rate must be positive")

Z  <-  -log(runif(N))/rate

X  <-  ifelse(runif(N)<0.5 ,  -Z,  Z)

X

|

Prove (analytically) that this function will return a random sample from the Laplace distribution with probability density function

f (x; λ)  =  eλ|北 |     for x IR

where the λ is the rate parameter of the distribution.

Hint:   Find P(Xi   ≤  x; λ)  considering x  <  0  and x  >  0  separately  and show  that derivative of this does give the required density.

Q. 2    a)  [10 marks]

Euler’s constant arises in number theory and is defined as

&

γ  =          log(x)e一北 dx

Write an R function to estimate γ  and give its standard error using Monte  Carlo simulation and give the results of running the function with a Monte Carlo simulation size of N = 1, 000, 000.

b)  [10 marks]

Write another function that uses antithetic variables to estimate γ and show that, for the same number of randam variables generated, the standard error of the antithetic variable estimator is much less that of the estimator in (a).

Hint: Recall that U  Uniform(0, 1)  ~  X = log(U) exponential(1).

Q. 3  Suppose that X1 , . . . , Xn is a random sample from an exponential distribution with mean µ . An approximate 95% confidence interval for µ which is commonly used in practice is given

by

                     

where

a(n)  =  1     and    b(n)  =  1 +

a)  [10 marks]

Show that if X      exponential(µ) then Z = X/µ      exponential(1) and that the coverage probability of the above interval can be written as

a(n)X < µ < b(n)X   =  P a(n)Z < 1 < b(n)Z   =  P  < Z <

Comment on the relevance of the above result for a simulation study to estimate the coverage of the interval.

b)  [10 marks]

Describe and implement a simulation study to assess how the coverage probability of this interval changes with n. Ensure that you give standard errors for any estimates of the coverage.

Q. 4  Suppose that X1 , . . . , Xn are a sample from a normal distribution with mean 0 and unknown standard deviation σ . We wish to conduct Bayesian inference for σ with the prior distribution that σ exponential(1). We will do this using an independence Metropolis-Hastings algorithm with candidate distribution equal to the prior for σ .

Use the following data for this question and also for Question 5.

-4.46   -4.09   -3.66   -2.82   -2.45   -2.16   -2.12   -1.51   -1.41   -1.32

-1.26   -0.97   -0.53   -0.46   -0.29     0.55     0.69     1.29     3.52     4.07

a)  [5 marks]

Show that the posterior distribution for σ is of the form

π(σ } x1 , . . . , xn )     exp {σ  }       σ > 0

b)  [5 marks]

Suppose that σ is a candidate drawn from the prior distribution and that the current state of the chain is σt1 . Show that the probability of moving at iteration t is equal to

ρt   =   min { Lt一(σ) 1 }

c)  [10 marks]

Implement this independence Metropolis-Hastings algorithm to get a sample from the posterior distribution of σ and estimate the posterior mean, posterior standard deviation and an equitailed posterior 95% credible interval for σ .

Q. 5 In this question we shall do a frequentist analysis of the same data and model as in Question 4 using the bootstrap.

a)  [10 marks]

Assuming the population distribution is Normal(0, σ) find the maximum likelihood estimator for σ and use a parametric bootstrap to estimate the bias and standard error of the maximum likelihood estimator.  Also construct a 95% confidence interval for σ using the basic bootstrap method.

b)  [10 marks]

Now suppose that the only assumption we make about the population distribution is that it has a nite standard deviation σ which we wish to estimate based on the same data. Find the plug-in estimator of σ and use the non-parametric bootstrap to estimate the bias and standard error of this estimator and again use the basic bootstrap method to construct a 95% confidence interval for σ based on the non-parametric bootstrap.