File Exchange

image thumbnail

Compound Poisson simulation

version 1.1 (4.82 KB) by

benchmarks several versions of code for generating Compound Poisson random variables

11 Downloads

Updated

View License

Compound Poisson random variables are of the form S=X1+...+XN where the Xj are iid random variables and N is random with the Poisson distribution. Compound Poisson variables have many applications in physics and finance.

This file benchmarks several codes for generating 1 million random samples from a Compound Poisson distribution where the terms are Lognormal with mu=0 and sigma=1 and the Poisson frequency is 10.

The run times vary by a factor of more than 200 between the fastest and slowest versions (in R2009b). Interestingly, the fastest code is 10 times faster than the neat 1-liner that uses ARRAYFUN.

Requires POISSRND (Statistics Toolbox) and RANDRAW (FEX #7309).

Comments and Ratings (0)

Updates

1.1

updated comments

MATLAB Release
MATLAB 7.9 (R2009b)
Acknowledgements

Inspired by: RANDRAW

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video