MATLAB question regarding demographic stochasticity

  • Context: MATLAB 
  • Thread starter Thread starter chuy52506
  • Start date Start date
  • Tags Tags
    Matlab
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
chuy52506
Messages
77
Reaction score
0
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 = [];
x0=1000;
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];
end
plot(0:N,xlist)

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?
 
Physics news on Phys.org
chuy52506 said:
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 = [];
x0=1000;
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];
end
plot(0:N,xlist)

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?

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.