Presentation is loading. Please wait.

Presentation is loading. Please wait.

MATH 3033 based on Dekking et al

Similar presentations


Presentation on theme: "MATH 3033 based on Dekking et al"— Presentation transcript:

1 MATH 3033 based on Dekking et al
MATH 3033 based on Dekking et al. A Modern Introduction to Probability and Statistics Slides by Longin Jan Latecki C6:

2 GaussianEx1.m plots histogram of samples drawn from a Gaussian with mean zero and std one and plots the Gaussian with mean 1 and std 1. Values of histogram are normalized so that the sum of the area of the histogram bars (rectangles) is equal to 1. This way both plots are directly comparable, since the area under the Gaussian curve is also one. x = -5:0.1:5; g=normpdf(x,0,1); samples=randn(1000,1); %samples = normrnd(0,1,1000,1); [hs, hx] = hist(samples,x); hs=(hs/1000)*(101/10); figure; bar(x,hs,'r'); hold on plot(x,g,'LineWidth',3);

3 SamplingEx1.m plots histogram of samples drawn from exponential distribution and plots the exponential distribution Values of histogram are normalized so that the sum of the area of the histogram bars (rectangles) is equal to one. This way both plots are directly comparable. x = 0:0.1:10; lambda=1; f=lambda*exp(-lambda*x); %sample from uniform dist. U(0,1) samples=rand(1000,1); %samples = normrnd(0,1,1000,1); samples=-(1/lambda)*log(1-samples); [hs, hx] = hist(samples,x); hs=(hs/1000)*(101/10); figure; bar(x,hs,'r'); hold on plot(x,f,'LineWidth',3);


Download ppt "MATH 3033 based on Dekking et al"

Similar presentations


Ads by Google