## Description

Linko¨pings Universitet, IDA, Statistik

Kurskod och namn: 732A90 Computational Statistics

Delmomentsansvarig: Krzysztof Bartoszek, Bayu Brahmantio, Jaskirat Marar, Shashi Nagarajan

Instruktioner: This computer laboratory is part of the examination for the

Computational Statistics course

Create a group report, (that is directly presentable, if you are a presenting group), on the solutions to the lab as a .PDF file.

Be concise and do not include unnecessary printouts and figures produced by the software and not required in the assignments.

All R code should be included as an appendix into your report. A typical lab report should 2-4 pages of text plus some amount of figures plus appendix with codes.

In the report reference ALL consulted sources and disclose ALL collaborations.

The report should be handed in via LISAM

The report has to be written in English.

Question 1: Stable distribution

A random variable has a so called one–sided strictly stable distribution of order 1/2 if for a parameter c > 0 it has density equalling

√ 2 f(x) = c( 2π)−1e−c /(2x)x−3/21(0,∞)(x).

In particular the support is on (0,∞). The aim of the assignment is to sample from this distribution by using an acceptance–rejection algorithm with the help of a power–law distribution with density

for Tmin > 0, α > 1. In particular the support is on (Tmin,∞).

1. Plot f(x) and fp(x) together. Can the power–law distribution be used just by itself or is there a problem at any place of the support Explain what the problem is and how can it be taken care of. Provide values of the power–law distribution’s parameters that can be used in the acceptance–rejection algorithm. Derive and implement a majorizing density.

2. Implement an acceptance–rejection algorithm for sampling from the one–sided strictlystable distribution of order 1/2 with the proposal distribution built around the power– law distribution. To sample from a power–law distribution you can use the function poweRlaw::rplcon().

3. Generate a large sample using your implemented sampler, for different choices of c. Present the sample graphically. What is the mean and variance and how do they depend on c? Study the rejection rate.

Question 2: Laplace distribution

The double exponential (Laplace) distribution is given by formula:

1. Write a code generating double exponential distribution DE(0,1) from Unif(0,1) by using the inverse CDF method. Explain how you obtained that code step by step. Generate 10000 random numbers from this distribution, plot the histogram and comment whether the result looks reasonable.

2. Use the Acceptance/rejection method with DE(0,1) as a majorizing density to generate N(0,1) variables. Explain step by step how this was done. How did you choose constant c in this method? Generate 2000 random numbers N(0,1) using your code and plot the histogram. Compute the average rejection rate R in the acceptance/rejection procedure. What is the expected rejection rate ER and how close is it to R? Generate 2000 numbers from N(0,1) using standard rnorm() procedure, plot the histogram and compare the obtained two histograms.

## Reviews

There are no reviews yet.