Closed simoncarrignon closed 11 months ago
still problem with dead partners that don't disappear correctly/seem to cause trouble .
seems to be fixed by 1309224c55ffbee57c3240913ce78f3d8c698abd
Should death be age dependant?
For what we said we have:
Can we derive some expectation about population growth for two populations of size N, one with $\lambda=b$ the other with $\lambda=b+r$ given different value of $b$ , $r$ and $m$ ?
We probably need/can do a couple of rough approximation, like $m=1$.
Then, how do we want to initialise these variables with credible values?
Started playing with this which gives :
b=.2
r=.1
N=100
dur=10
d=0.001
hg=vector("numeric",dur)
fa=vector("numeric",dur)
hg[1]=fa[1]=N
for(i in 2:dur){
hg[i]=hg[i-1]+sum(rpois(hg[i-1],b+r*sum(c(0,0,0))))-hg[i-1]*d
fa[i]=fa[i-1]+sum(rpois(fa[i-1],b+r*sum(c(1,1,1))))-fa[i-1]*d
}
plot(1,1,type="n",ylim=range(hg,fa),xlim=c(0,dur))
lines(hg,col="red")
lines(fa)
But this is still very far from what the model gives ; probably because of non mature and non married agents...
Working on a vignette testDemo.Rmd
to check these things in more details.
I wanted to try simple approximations that our model will reproduce but it's a bit tricky.
I played with having no mature age and just one community of 1 type, to avoid migration, and I got results not to to far to something like:
$Nt=N{t-1}+\Sigma(poiss(b+r \times a,N{t-1}))-N{(t-1)} \times d$ with a=0 for I, 1 for M
The dotted line represent 100 run of the simplified equation where number of child is drawn from poisson distrib of $\lambda=b+r \times a$ where a=0 for incumbent population and 1 for migrants. The plain line represent 10runs of the model with one community of only one time (red uncomment only, red migrant only) .
They are still still not perfectly the same ; we are a bit further from a pure poisson distrib as for a couple to get child depends on multiple factor which I haven't include in the simplified model.... maybe I am also missing something obvious. Anyway probably trying to find way to compare them? some simpler model that could help us ot predict growth wrt to $b$,$r$,$d$
Should death be age dependant?
We have recently used a Moran model with a very simple age-dependent death probability: the older you are the more likely are you to die p_death_x = age_x/sum(age_y). In this study we explored adaptation to changing environments and if you let some individuals be very old they will have experienced a lot of conditions and so contribute substantially to the population-level adaptation process. That's why we used the age-dependent death. But here it may not make such a difference as old individuals do not reproduce anymore. They are still around and I guess can be copied but it hopefully wont change the dynamic qualitatively.
Assuming we choose a constant p_death= 0.02 then the mean life time is 50 years and with a probability of 0.13 individuals reach 100 and with 0.048 150. So there is a long tail and some individuals will be 300 years or older. However, I am not sure there existence will affect the dynamic greatly. Or is there a mechanism in the simulation that could benefit from those very old individuals?
For what we said we have:
* Number of child per couple follow poisson distribution with 位=b+r(a1+a2+a3)
I think \lambda should be a rate rather than the mean of the Poisson distribution. Our time step is now one year and so it seems unlikely that the there can be multiple children in successive years. I would interpret \lambda as the probability of producing an offspring in this year.
* rate of death d
see answer to comment before.
* probability to get married once age>18 is m * agent are sexually active for a fixed number of years St, starting from age they get married until a fixed age or the death of their partner (but then became active again if they get married again ).
Can we derive some expectation about population growth for two populations of size N, one with 位=b the other with 位=b+r given different value of b , r and m ?
We probably need/can do a couple of rough approximation, like m=1.
Yes m=1 seems helpful. Then I would generate the Leslie matrix with fertility vales set to 0 outside the age range [18,40], within simply b or b+r. The survival rates are (1-p_death) if we keep p_death constant or p_death is replaced by the age-dependent death rate. Then we calculate the eigenvalue of the Leslie matrix what should give us the growth rate of the female population. Of course using the Leslie matrix we must define a maximum age --- which in the simulation depends on the chosen death rate. If --- for p_death=0.02 --- we set the death rate of individuals of age 150 to 1 we will miss 5% of the population, for 200 1.7% and 250 0.64%. These are kind of acceptable errors.
Then, how do we want to initialise these variables with credible values?
Maybe p_death = 0.02 and b = 0.02 (no average population growth in the initial population?) and then we need to see which increments r make already differences to the dynamic?
Thanks Anne!
So yes $\lambda$ in the current implementation is the birth rate. But given what was written before and knowing that it represents the probability for each couple to give birth I was thinking we could use a poisson distribution to approximate it at population level and thus have a simpler equation to get a quick estimation of growth under certain parameters. It's not working very well as the graph in my comment before shown :smile:
I tried p_death =0.02 and $\lambda=b=0.02$ ; Am wrong or I need b=2*p_death to get stable population, as pdeath applies to single individual while b to couple (two partners in the same couple can only have one child a year)? In any case even with $b=2\times p{death}$ it's not exactly righ You can see below the result for 40 simulation with 2 communities (but r=0 so doesn't really maters) And the population size goes down. I need it to be a bit above $2\times p_{death}$ to stay stable. Maybe due to randomnes/mating? or some problem in my code.
Thanks Anne!
So yes 位 in the current implementation is the birth rate. But given what was written before and knowing that it represents the probability for each couple to give birth I was thinking we could use a poisson distribution to approximate it at population level and thus have a simpler equation to get a quick estimation of growth under certain parameters. It's not working very well as the graph in my comment before shown 馃槃
Ah sorry. But in this case, I would use a binomial distribution with p=b or b+r and n= #number of reproducing couples.
I tried p_death =0.02 and 位=b=0.02 ; Am wrong or I need b=2*p_death to get stable population, as p_death applies to single individual while b to couple (two partners in the same couple can only have one child a year)? In any case even with b=2脳pdeath it's not exactly righ You can see below the result for 40 simulation with 2 communities (but r=0 so doesn't really maters) And the population size goes down. I need it to be a bit above 2脳pdeath to stay stable. Maybe due to randomnes/mating? or some problem in my code.
Hah good point! I struggle to get into sexual reproduction mode. The figs look good --- I would expect that. If birth equals death rate we have on average no growth, meaning that stochastic effects can drive the population either to extinction or to growth.
https://github.com/simoncarrignon/mixed-transmission/blob/3616cba050765ef07171df15d91e6294037155b6/generalExploration.Rmd#L116C1-L116C50
Probably need to when dealing with death