Download Assignment 2

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

Karhunen–Loève theorem wikipedia , lookup

Infinite monkey theorem wikipedia , lookup

Negative binomial distribution wikipedia , lookup

Expected value wikipedia , lookup

Law of large numbers wikipedia , lookup

Transcript
MTH 511 : Statistical Simulation and Data Analysis-2017
Assignment 2
1
2
1. Write a program to generate n values from the probability mass function p1  , p2  .
3
3
(a)
Let n = 100, run the program, and determine the proportion of values that are equal to 1.
(b)
Repeat (a) with n = 1000.
(c)
Repeat (a) with n = 10,000.
2. Write a computer program that, when given a probability mass function { p j , j  1, 2,..., n} as an input,
gives as an output the value of a random variable having this mass function.
3. Give an efficient algorithm to simulate the value of a random variable X such that P( X  1)  0.3 ,
P( X  2)  0.2 , P ( X  3)  0.35 , P( X  4)  0.15
4. A deck of 100 cards-numbered 1,2,…,100 is shuffled and then turned over one card at a time. Say that
a “hit” occurs whenever card i is the ith card to be turned over, i = 1,2,…,100. Write a simulation
program to estimate the expectation and variance of the total number of hits. Run the program, Find
the exact answers and compare them with your estimates.
5. Using an efficient procedure, along with the text’s random number sequence, generate a sequence of 25
independent Bernoulli random variable, each having parameter p = .8. How many random numbers
were needed?
6. Write down an algorithm and program to generate independent but not identically distributed Bernoulli
random variables.
7. A pair of fair dice are to be continually rolled until all the possible outcomes 2,3,…,12 have occurred
at least once. Develop a simulation study to estimate the expected number of dice rolls that are needed.
8. The negative binomial probability mass function with parameters (r, p), where r is a positive integer
and 0 < p < 1, is given by
( j  1)!
pj 
p r (1  p) j r ; j  r , r  1,...
( j  r )!(r  1)!
(a) Use the relationship between negative binomial and geometric random variables and the results of
related to the generation of geometric random variable to obtain an algorithm for simulating from
this distribution.
j (1  p)
(b) Using the recurrence relation p j 1 
p j , give a second algorithm for generating negative
j 1 r
binomial random variables.
(c) Use the interpretation of the negative binomial distribution as the number of trials it takes to amass a
total of r successes when each trial independently results in a success with probability p, to obtain
still another approach for generating such a random variable.
1
9. Give two methods for generating a random variable X such that
exp( ) i / i !
P( X  i)  k
, i  0,1,..., k .
j
 exp( ) / j !
j 0
10. Let X be a binomial random variable with parameters n and p. Suppose that we want to generate a
random variable Y whose probability mass function is the same as the conditional mass function of X
given that X  k , for some k  n . Let   P( X  k ) and suppose that the value of  has been
computed.
(a)
Give the inverse transform method for generating Y.
(b)
Give a second method for generating Y.
(c)
For what values of  , small or large, would the algorithm in (b) be inefficient.
11. Give a method for simulating X, having the probability mass function p j , j  5, 6,...,14 where
0.11 when j is odd and 5  j  13
pj  
0.09 when j is even and 6  j  14.
Use the text’s random number sequence to generate X.
12. Suppose that the random variable X can take on any of the value 1,2,…,10 with respective probabilities
0.06, 0.06, 0.06, 0.06, 0.06, 0.15, 0.13, 0.14, 0.15, 0.13. Use the composition approach to give an
algorithm that generates the value of X. Use the text’s random number sequence to generate X.
13. Present a method to generate the value of X, where
 1  j 1
j 1
 2
2
1
P( X  j )       j , j  1, 2,...
3
2
Use the text’s random number sequence to generate X.
14. A random selection of m balls is to be made from an urn that contains n balls, ni , of which have color
type i, i 1 ni  n . Discuss efficient procedures for simulating X1 , X 2 ,..., X r where X i denotes the
r
number of withdrawn balls that have color type i.
15.
Give details about how to generate the random numbers from independent but not identically
distributed random variable X following a Binomial distribution.
16.
Consider the setup of linear regression model Y  X    , E ( )  0,V ( )   2 where  is a
n1
n p p1
n1
positive definite matrix. Judge the performance of ordinary least squares estimator and generalized least
squares estimator of regression coefficient when random errors follow a normal distribution, gamma
distribution and t distribution.
2