Closed crangelsmith closed 4 years ago
Hi @kasra-hosseini , just to let you know (and avoid duplicating work) that the function to compute migration rates developed in PR #32 should work for both the emigration rates and immigration rates.
Hi @crangelsmith, great! Thanks! I am reviewing the PR now.
Branch: feature/29-build-an-immigration
Hi again @crangelsmith , I used your code to plot the migration rates and here is a plot:
To reproduce:
# Population (total)
plt.figure(figsize=(15, 10))
plt.plot(asfr_data_emigration["age_start"],
asfr_data_emigration["mean_value"],
'.', c='k', lw=4, markersize=12)
plt.xlabel("Age", size=32)
plt.ylabel("Migration rate", size=32)
plt.xticks(size=24, rotation=90)
plt.yticks(size=24)
plt.grid()
plt.show()
I am wondering if the large values at older ages are expected?
Hi @kasra-hosseini , thanks for spotting this! I did some checks and I think this is a product of categories with very low statistics, where the predicted number of migrants is higher that the total number of people in that area. I found this particular case:
I guess we will have to cater for this scenarios, let's discuss with Nik tomorrow about it.
Hi @crangelsmith Sounds good and thanks for checking. I also implemented the very first version of the immigration component. It is deterministic now in the sense that the total number of immigrants should be specified a priori. Then, at each time step, we sample from the migration rates to assign age/gender/... to the new immigrants. Here is one output example in which:
(no fertility)
I still need to review and add the test_immigration.py
. Once these are finished, I will send a PR.