Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Converting this program from Octave to R: Hi, can anyone who knows Octave rewrite this exact code in R? I have never used Octave and

Converting this program from Octave to R:

image text in transcribed

Hi, can anyone who knows Octave rewrite this exact code in R? I have never used Octave and can't figure it out. Thanks

The following Octave program generates 10000 iid standard normal draws by rejection sampling from a standard Cauchy distribution. You should check the output array IN to confirm that the resulting values are actually normal rather than Cauchy The counter ii keeps track of the total number of Cauchy draws generated. I got a total of 15, 370 (it is a random variable hence your results may vary). Thus around 1.5 uniform draws must be generated for each normal value produced. The Box-Muller method generates one normal draw per uniform draw, so is more efficient. 11 =0; for it-1:10000 while (1) Z = tan (pi*rand (1,1)); R - exp(-Z 2/2) (1+Z2)*sqrt (e)/2; if (rand(1,1) R) break; endif endwhile endfor

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

PostgreSQL Up And Running A Practical Guide To The Advanced Open Source Database

Authors: Regina Obe, Leo Hsu

3rd Edition

1491963417, 978-1491963418

More Books

Students also viewed these Databases questions

Question

Define additional paid-in capital.

Answered: 1 week ago

Question

Discuss five types of employee training.

Answered: 1 week ago

Question

Identify the four federally mandated employee benefits.

Answered: 1 week ago