{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

STA5106_FRADE_HW8-2

STA5106_FRADE_HW8-2 - Jaime Frade CODE m=5000 n=500 z(1)=1...

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

STA5106: Dr. Srivastava Homework 8 Jaime Frade 1. OUTPUT CODE alpha_1=1; beta_1 = 0.5; sim= 1000; X = zeros(sim,1); U = rand(sim,1); for i=1: sim, X(i,1) = weibull_RV(U(i,1), alpha_1, beta_1); end ; figure(2) hist(X); xlabel( 'x' ); ylabel( 'P(x)' ); title( 'Weibull Distribution' ); 2.

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

View Full Document
STA5106: Dr. Srivastava Homework 8 Jaime Frade OUTPUT X = 0.0808 CODE Y = exponential_RV(rand); X = (rand)^(1/Y);
STA5106: Dr. Srivastava Homework 8 Jaime Frade 3. OUTPUT for k= 1 to 5. Y = 1 2 1 0 0 The following is the mean and variance of Y k : mean = 0.9870 0.4980 0.3322 0.2542 0.1954 variance = 1.0246 0.5005 0.3287 0.2588 0.1945 Comment: The mean and variance are close in values. The distribution resembles a Poisson distribution with mean = 1/k. (k=1 to 5) 0 5 10 0 500 1000 1500 2000 0 5 0 1000 2000 3000 0 2 4 0 1000 2000 3000 4000 0 2 4 0 1000 2000 3000 4000 0 2 4 0 1000 2000 3000 4000 5000

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

View Full Document
STA5106: Dr. Srivastava Homework 8
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Jaime Frade CODE m=5000; n=500; z(1)=1; for j=1:m X=-log(rand(1,n)); for i=2:n if X(i)>=max(X(1:i-1)) z(i)=1; else z(i)=0; end end for k=1:5 Y(j,k)=length(find(diff(find(z>=0.5))==k)); end end mean=mean(Y) variance=var(Y) for h=1:5 subplot(2,3,h); hist(Y(:,h)); end for p=1:5 RandPoisson(:,p)=poissrnd(1/p,5000,1); end meanPoisson=mean(RandPoisson) varPoisson=var(RandPoisson) STA5106: Dr. Srivastava Homework 8 Jaime Frade 4. ∏ ∏ = = 2200 < = = n i i n i i i x X P x F x F 1 1 }, { ) ( ) ( n i i x X P 1 ) ( = < = ) , , , max( 2 1 n X X X X = To generate a RV from distribution above, use the following algorithm 1. Generate X i from F i (x) for i=1,2, …,n 2. Set X = max(x i ) X is a RV for F(x)...
View Full Document

{[ snackBarMessage ]}

Page1 / 5

STA5106_FRADE_HW8-2 - Jaime Frade CODE m=5000 n=500 z(1)=1...

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

View Full Document
Ask a homework question - tutors are online