Download Lab 1 - IDA.LiU.se

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Statistics wikipedia , lookup

History of statistics wikipedia , lookup

Randomness wikipedia , lookup

Transcript
732A26 Computational statistics
Department of Computer and Information Science
Computer lab 1: Random number generation
Learning objectives
The main objective of this computer lab is to make the student acquainted with widely
used techniques to generate random numbers with a given probability distribution.
After completing the lab the student shall be able to:
(i)
(ii)
(iii)
examine the performance of a random number generator;
efficiently generate large sets of random numbers with a standard bivariate
normal distribution;
explain the principle of antithetic sampling
Assignment 1: Assess the performance of random number
generators
Random number generators are normally constructed to mimic the behaviour of
independent random variables being uniformly distributed on the unit interval (0,1).Your
task is to assess the performance of the random number generators in Excel and Minitab.
In particular you shall investigate whether or not the random numbers behave like
independent random variables.
Generate a long sequence of pairs of random numbers (10000 pairs in Excel and 1000000
pairs in mintab) and compute the correlation. Is the correlation significantly different
from zero?
Generate a long sequence of triplets and investigate whether or not these triplets fill out
the upper right corner of the unit cube {(x, y, z), x>1-h, y>1-h, z>1-h} as expected.
Choose a suitable value of h and test whether the probability of getting a random number
in the selected corner is h3.
Assignment 2: Assess the performance of different methods to
generate bivariate normal distributions
Your task is to compare the performance of the following methods to generate
observations from a bivariate zero mean normal distribution with covariance matrix equal
to the identity matrix:
Method 1. Using Minitab’s random number
Method 2. Generating sums of uniformly distributed random numbers
Method 3. Generating bivariate distributions using polar coordinates
Method 4. Using the envelope-rejection method
732A26 Computational statistics
Department of Computer and Information Science
The assessment shall focus on the performance of the random numbers in the tails of the
bivariate distribution, i.e. the ability of the methods to generate events of the form {(x, y);
x2 +y2 > r} with correct probability. In addition, you are asked to make a rough
assessment of the computational time needed to generate a sample of size 1000000 from
a bivariate normal distribution.
Hints: The assignment can be done in Minitab. The envelope function used in method 4
can be proportional to the density of a double exponential distribution, i.e. you can
choose g(x) = 0.5exp(-|x|) and then multiply g(x) with a suitable constant c so that c g(x)
is always greater than the density of a standard, univariate normal distribution,
Assignment 3: Antithetic sampling
Consider the integral
1
1
2
0 2 exp(  x / 2)dx
We shall estimate this integral using Monte-Carlo simulation with 100 random numbers.
Your task is to investigate whether the accuracy of the integration can be enhanced by
using some form of antithetic sampling.
Start by using Minitab’s cumulative distribution function of a standard normal
distribution to compute a “correct” value of the integral.
Then make about 10 repeated estimates of the integral using: (i) ordinary random
numbers, (ii) antitheric sampling with 50 random numbers in each of the two subsets.
To hand in
A short report with the results of your simulations including uncertainty estimates.