1 / 6

Basic problem

Basic problem. A random variable X follows the exponential distribution, p(x)= exp (-x) for x=>0. Check how different ways of sampling will compare in terms of accuracy for estimating the probability of x>2 with 1,000 samples. Exact value of probability is exp (-2)=0.1353.

nyx
Download Presentation

Basic problem

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Basic problem • A random variable X follows the exponential distribution, p(x)=exp(-x) for x=>0. Check how different ways of sampling will compare in terms of accuracy for estimating the probability of x>2 with 1,000 samples. • Exact value of probability is exp(-2)=0.1353.

  2. From actual distribution x=exprnd(1,1,1000); y=sum((sign(x-2)+1)/2)=142 x=exprnd(1,1,1000); y=sum((sign(x-2)+1)/2)=126 x=exprnd(1,1,1000); y=sum((sign(x-2)+1)/2)=138 x=exprnd(1,1,1000); y=sum((sign(x-2)+1)/2)=115 x=exprnd(1,1,1000); y=sum((sign(x-2)+1)/2)=154 x=exprnd(1,1,1000); y=sum((sign(x-2)+1)/2)=134 • Estimatedrelativeaccuracybasedon 142 is • Exactrelativeaccuracyis

  3. Rejection sampling from a gamma distribution • Pick a gamma distribution with a=1, b=2. • Need M=2 for bounding. x=gamrnd(1,2,1,1000); p=exppdf(x); q=gampdf(x,1,2); ratio=p./(2*q); ratio(1:10) accepttest=rand(1,1000); accept=(sign(ratio-accepttest)+1)/2; acceptsample=x.*accept; exceed=sum(sign(acceptsample-2)+1)/2=72; 64; 61 nsamples=sum(sign(acceptsample))=490;519; 516 prob=exceed/nsamples=0.1469;0.1233; 0.1182 Repeated 3 times

  4. Question • Why the number of accepted samples is more stable than the estimate of the probability?

  5. Importance sampling from same distribution ratio=p./q; exceedsamples=(sign(x-2)+1)/2; exceed=sum(exceedsamples.*ratio)=145.4; 131.7; 132.4 %To get estimate of probability divide by 1,000 ratio=ratio/sum(ratio); exceed=sum(exceedsamples.*ratio)=0.1499; 0.1311; 0.1279 %With normalized weight get probability directly.

  6. Bootstrapping • Illustrate bootstrapping for estimating accuracy of probability of x>2 from actual distribution. x=exprnd(1,1,1000); y=sum((sign(x-2)+1)/2)=143 for i=1:100 xs=datasample(x,1000); y(i)=sum((sign(xs-2)+1)/2); end mean(y)=143.0500 std(y)=10.4566 y(1:10)=159 140 134 121 149 147 126 163 138 141

More Related