Problem3_8

# Problem3_8 - nsim = 100000 M = 7.456449 randvars =%vector...

This preview shows pages 1–2. Sign up to view the full content.

Problem 3.8 STA 6934 Damaris Santana-Morant 1. g 1 ( x ) = 1 2 e -| x | M = sup y e - y [sin( y )] 2 1 2 e -| y | = sup y 2[sin( y )] 2 e - y + | y | . Since y < | y | for y > 1, - y + | y | > 0 for y > 1. Thus e - y + | y | → ∞ as y → ∞ and M = . Thus AR no longer apply, an alternative MCMC methods. 2. g 2 ( x ) = 1 2 2 sech 2 ( x 2 ) M = sup y e - y [sin( y )] 2 1 2 2 sech 2 ( y 2 ) = sup y 2 2[sin( y )] 2 e - y e y 2 + e - y 2 4 < sup y 2[sin( y )] 2 e - y e y 2 Since y < y 2 for y > 2, - y + x 2 > 0 for y > 2. Thus e - y +( y/ 2) → ∞ as y → ∞ and M = . Thus AR no longer apply, an alternative MCMC methods. 3. g 3 ( x ) = 1 2 π 1 1+ x 2 / 4 M = sup y e - y [sin( y )] 2 1 2 π 1 1+ y 2 / 4 = 7 . 456449 . It occurs at y = 14 . 14 (Figure 1). For one simulation the mean was 6.4835 and the histogram is shown in Figure 2. The Matlab code for the Accept Reject Algorithm is the following: 1

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
%This program will generate nsim random variables from %the density f(x)=exp{-sqrt(x)}*[sin(x)]^2 using the %Accept Reject Algorithm with candidate density Cauchy(0,2).
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: nsim = 100000; M = 7.456449; randvars = ; %vector of simulated random variables i = 0; while (i <= nsim) u_1 = rand(1,1); u_2 = rand(1,1); Y = 2*tan((u_2-1/2)*pi); %generate Cauchy(0,2) if (Y > 0) %consider Cauchy variables such that 0<Y<\infty temp = (1/M)*(exp(-sqrt(Y))*[sin(Y)]^2)/(1/(2*pi*(1+Y^2/4))); if (u_1 < temp) randvars = [randvars;Y]; i = i + 1; end end end 4. g 4 ( x ) = 1 2 π e-x 2 2 (Corrected by George Casella) M = sup y e-√ y [sin( y )] 2 1 2 π e-y 2 2 = sup y 2 π [sin( y )] 2 e-√ y + y 2 / 2 . Since √ y < y 2 2 for y > 4 1 / 3 ,-√ y + y 2 2 > 0 for y > 4 1 / 3 . Thus e-√ y + y 2 / 2 → ∞ as y → ∞ and M = ∞ . Thus AR no longer apply. 2...
View Full Document

## This note was uploaded on 01/15/2012 for the course STA 6934 taught by Professor Young during the Fall '08 term at University of Florida.

### Page1 / 2

Problem3_8 - nsim = 100000 M = 7.456449 randvars =%vector...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online