Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

USE R TO ANSWER EXERCISE 4. USE EXAMPLE 2.3 AS REFERENCE. # EXERCISE 4 # Program the Box-Muller transform (see Example 2.3 in the text)

USE R TO ANSWER EXERCISE 4. USE EXAMPLE 2.3 AS REFERENCE.

image text in transcribedimage text in transcribed

# EXERCISE 4 # Program the Box-Muller transform (see Example 2.3 in the text) and compare visually (using two different types of plots) with the built-in rnorm function One way to achieve normal random variable simulation using a transform is with the Box-Muller algorithm, devised for the generation of N(0, 1) variables Example 2.3. If Ui and U2 are iid Ujo,1], the variables X1 and X2 defined by Xi = V-2 log(U) cos(2nU2) , X2- V-2 log(U1) sin(2TU2), are then iid N(0,1) by virtue of a simple change of variable argument. Note that this is not the generator implemented in R, which uses by default the probability inverse transform, based on a very accurate representation of the normal cdf inverse qnorm (up to 16 digits!). (It is, however, possible, if not recommended to switch the normal generator to the Box-Muller (or even to the Kinderman- Ramage) version via the RNG function.) In comparison with (crudely) approximative algorithms based on the Cen- tral Limit Theorem (CLT), the Box-Muller algorithm is exact, producing two normal random variables from two uniform random variables, the only draw- back (in speed) being the necessity of calculating transcendental functions such as log, cos, and sin. # EXERCISE 4 # Program the Box-Muller transform (see Example 2.3 in the text) and compare visually (using two different types of plots) with the built-in rnorm function One way to achieve normal random variable simulation using a transform is with the Box-Muller algorithm, devised for the generation of N(0, 1) variables Example 2.3. If Ui and U2 are iid Ujo,1], the variables X1 and X2 defined by Xi = V-2 log(U) cos(2nU2) , X2- V-2 log(U1) sin(2TU2), are then iid N(0,1) by virtue of a simple change of variable argument. Note that this is not the generator implemented in R, which uses by default the probability inverse transform, based on a very accurate representation of the normal cdf inverse qnorm (up to 16 digits!). (It is, however, possible, if not recommended to switch the normal generator to the Box-Muller (or even to the Kinderman- Ramage) version via the RNG function.) In comparison with (crudely) approximative algorithms based on the Cen- tral Limit Theorem (CLT), the Box-Muller algorithm is exact, producing two normal random variables from two uniform random variables, the only draw- back (in speed) being the necessity of calculating transcendental functions such as log, cos, and sin

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Securing SQL Server Protecting Your Database From Attackers

Authors: Denny Cherry

2nd Edition

1597499471, 978-1597499477

More Books

Students also viewed these Databases questions