MATLAB MATLAB question regarding demographic stochasticity

  • Thread starter Thread starter chuy52506
  • Start date Start date
  • Tags Tags
    Matlab
AI Thread Summary
The discussion focuses on calculating the probability that the population x(100) is greater than or equal to 10,000 using MATLAB. The population dynamics are defined by a recursive equation influenced by normally distributed parameters A and B. Key calculations involve determining the expected value and variance of the population at each time step, utilizing properties of random variables. The normal distribution parameters for p(100) are derived, leading to the conclusion that the cumulative distribution function (CDF) can be used to find the desired probability. Users are advised to verify the calculations for accuracy before implementation.
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.
 

Similar threads

Replies
10
Views
3K
Replies
3
Views
3K
Replies
2
Views
2K
Replies
18
Views
4K
Replies
4
Views
3K
Replies
8
Views
2K
Back
Top