Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have already chosen my c, I used this line of code to find that 2 is an appropriate choice for c: all(2*dcauchy(seq(-10,10,.01))>dnorm(seq(-10,10,.01))) Here is

image text in transcribed

I have already chosen my c, I used this line of code to find that 2 is an appropriate choice for c:

all(2*dcauchy(seq(-10,10,.01))>dnorm(seq(-10,10,.01)))

Here is the rejection sampling example from notes:

# Rejection Sampling #

# Generate 1000 beta vairiates from the Beta(2, 2)

n

k

j

x

while(k

u

j

y

if (y*(1-y) > u){

#we accept y

k

x[k]

}

}

# Compare empirical and theoretical percentiles

p

Qhat

Q

round(rbind(Qhat, Q), 3)

plot(Q, Qhat)

Problem 3. The normal distribution is one of the most important distribution in statistics because the nature provides numerous examples of populations of measurements that, at least approximately, follow a normal distribution (a) Use the rejection sampling method to generate a random sample of size 1000 from the standard normal distribution. Use a standard Cauchy distribution as a proposal distribution g(y). You can generate a random sample from the standard Cauchy distribution using rcauchy). Moreover, you can calculate normal density and Cauchy density using dnorm) and dcauchy) respectively. Choose c such that f(u) 3 cg() and report your choice of c. # Write R code b) Compute the sample percentiles and compare with the standard normal distribution percentiles. # Write R code Problem 3. The normal distribution is one of the most important distribution in statistics because the nature provides numerous examples of populations of measurements that, at least approximately, follow a normal distribution (a) Use the rejection sampling method to generate a random sample of size 1000 from the standard normal distribution. Use a standard Cauchy distribution as a proposal distribution g(y). You can generate a random sample from the standard Cauchy distribution using rcauchy). Moreover, you can calculate normal density and Cauchy density using dnorm) and dcauchy) respectively. Choose c such that f(u) 3 cg() and report your choice of c. # Write R code b) Compute the sample percentiles and compare with the standard normal distribution percentiles. # Write R code

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions