Robert_V._Hogg,_Joseph_W._McKean,_Allen_T._Craig

(Jacob Rumans) #1
4.8. The Method of Monte Carlo 301

4.8.2.Recall that log 2 =

∫ 1
0

1
x+1dx. Hence, by using a uniform(0,1) generator,
approximate log 2. Obtain an error of estimation in terms of a large sample 95%
confidence interval. Write an R function for the estimate and the error of estimation.
Obtain your estimate for 10,000 simulations and compare it to the true value.
4.8.3.Similar to Exercise 4.8.2 but now approximate

∫ 1. 96
0
√^1
2 πexp

{
−^12 t^2

}
dt.

4.8.4. SupposeX is a random variable with the pdffX(x)=b−^1 f((x−a)/b),
whereb>0. Suppose we can generate observations fromf(z). Explain how we can
generate observations fromfX(x).


4.8.5. Determine a method to generate random observations for the logistic pdf,
(4.4.11). Write an R function that returns a random sample of observations from
a logistic distribution. Use your function to generate 10,000 observations from this
pdf. Then obtain a histogram (usehist(x,pr=T),wherexcontains the observa-
tions). On this histogram overlay a plot of the pdf.


4.8.6.Determine a method to generate random observations for the following pdf:


f(x)=

{
4 x^30 <x< 1
0elsewhere.
Write an R function that returns a random sample of observations from this pdf.
4.8.7.Obtain the inverse function of the cdf of the Laplace pdf, given byf(x)=
(1/2)e−|x|,for−∞<x<∞. Write an R function that returns a random sample
of observations from this distribution.
4.8.8.Determine a method to generate random observations for the extreme-valued
pdf that is given by
f(x)=exp{x−ex}, −∞<x<∞. (4.8.15)

Write an R function that returns a random sample of observations from an extreme-
valued distribution. Use your function to generate 10,000 observations from this pdf.
Then obtain a histogram (usehist(x,pr=T),wherexcontains the observations).
On the histogram overlay a plot of the pdf.


4.8.9.Determine a method to generate random observations for the Cauchy distri-
bution with pdf


f(x)=

1
π(1 +x^2 )

, −∞<x<∞. (4.8.16)

Write an R function that returns a random sample of observations from this Cauchy
distribution.


4.8.10.Suppose we are interested in a particular Weibull distribution with pdf


f(x)=

{ 1
θ^33 x

(^2) e−x^3 /θ^30 <x<∞
0elsewhere.
Determine a method to generate random observations from this Weibull distribu-
tion. Write an R function that returns such a sample.
Hint:FindF−^1 (u).

Free download pdf