Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

MATLAB MATLAB question regarding demographic stochasticity

  1. Mar 5, 2012 #1
    A population follows this equation:
    x(n+1)= 0 if x(n)≤2 and p(n+1) = A*x(n)-B if P(n)>2
    Where A=Normal(1.1,0.2) and B=Normal(100,20)
    Let the initial population x(0)=1000

    So far i created this mfile:
    xlist = [];
    x=x0; xlist=x; N=100;
    for n=1:N
    R = 1.1+.2*rand(1); a = 100+20*rand(1);
    x = R*x-a;
    xlist = [xlist,x];

    I ran it for 100 time steps

    The question is,
    What is the probability that x(100)≥10000?
    I have no idea how to calculate the probability of this using matlab, any ideas?
  2. jcsd
  3. Mar 5, 2012 #2


    User Avatar
    Science Advisor

    Hey chuy52506.

    The key thing to take note of is p(100).

    What you will have to do is find the parameters of the normal distribution for p(100). Just in case you are wondering it has to be normal since a normal + another normal = a normal.

    So basically if we want to get the parameters: we use the properties of Random Variables:

    E[aX+bY] = aE[X] + bE[Y]
    VAR(aX + bY) = a^2Var(X) + b^2VAR(Y)

    E[Ax(n)] = 1.1x(n)
    VAR(Ax(n)) = [x(n)]^2 x 0.2

    E = 100, Var(B) = 20

    By adding the means and variances we get our p(n) variable being:

    p(n) = Normal [ 1.1x(n) - 100, [x(n)]^2 x 0.2 + 20 ]

    Now you normalize the distribution and use a computer routine to find the CDF corresponding to p(n >= 10000) = 1 - p(n < 10000).

    Also make sure you double check my work just in case.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook