Sampling from a Poisson distribution

203 Views Asked by At

I am currently working on a thesis for my final year and am stuck with a problem involving the poisson process. I was wondering if someone could help me with it.

I am trying to simulate a one dimension correlated random walk. In this algorithm, the direction of a particle’s next step is correlated with the direction of it’s previous step. The particle’s step size is a constant dx. The particle continues in it’s direction with a probability of $1-\lambda dt$ and changes it’s direction with a probability of $\lambda dt$ where $\lambda$ is the reversal rate and $dt$ is the interval size. For this problem $\lambda$ lies between $0$ and 1.

In order to simulate this I have used a poisson process. I sample random variables based on the Poisson distribution and if the random variable is 1 the particle changes it’s direction and if it’s $0$ the particle stays in it’s previous direction. This logic isn’t working very well and I can’t seem to find the error. Could you please help me with this?

enter image description here