Skip to content
Snippets Groups Projects
Commit a47b8423 authored by sandcha's avatar sandcha
Browse files

Init memo for APL evolution according to base ressources

parent 26ee54d5
No related branches found
No related tags found
1 merge request!133Draft: Init memo for APL evolution according to base ressources
Pipeline #3139 failed
%% Cell type:markdown id: tags:
# Aides logement
...
## Références
* service-public : [ALS](https://www.service-public.fr/particuliers/vosdroits/F1280)
* openfisca-france : [ALS](https://legislation.fr.openfisca.org/als)
## Institutions concernées
## Publications & Aggrégats
* ...
%% Cell type:code id: tags:
``` python
# This script needs
# pip install matplotlib
# pip install seaborn==0.11.2
# pip install openfisca-france >= 80.2.0
from openfisca_france import FranceTaxBenefitSystem
from openfisca_france.scenarios import init_single_entity
tax_benefit_system = FranceTaxBenefitSystem()
current_period = 2022
STEPS_COUNT = 100
scenario = init_single_entity(
tax_benefit_system.new_scenario(),
# Axe declaration
axes=[
[
dict( # in a dictionary
count=STEPS_COUNT, # 'count' indicates the number of steps
min=0,
max=100000,
name="aide_logement_base_ressources", # the variable that will evolve 'count' times between 'min' and 'max' values
),
],
],
period=current_period,
menage = dict(
loyer=2106,
statut_occupation_logement="locataire_foyer", # openfisca_france.model.base.TypesStatutOccupationLogement.locataire_foyer
logement_conventionne=True
),
parent1=dict(
date_naissance="1980-01-01",
),
)
simulation = scenario.new_simulation()
aide_logement_base_ressources = simulation.calculate_add("aide_logement_base_ressources", current_period)
apl = simulation.calculate_add("apl", current_period)
print(f"Les {STEPS_COUNT} valeurs :")
print("apl : ", apl)
# print(simulation.menage.get_holder('statut_occupation_logement').get_array('2022-01'))
```
%% Output
Les 100 valeurs :
apl : [2055.36 2042.7599 2030.1597 2017.68 2005.1998 1992.7202
1980.2401 1967.88 1955.3998 1943.1597 1930.8002 1918.56
1906.1998 1894.0797 1881.7202 1869.6002 1857.4801 1845.3602
1833.2401 1821.2401 1809.12 1797.2401 1785.2401 1773.3602
1761.3602 1749.6002 1737.7202 1725.9598 1714.0797 1702.44
1690.56 1678.9203 1667.2798 1652.7599 1636.32 1620.12
1604.0402 1587.9598 1571.7599 1555.9203 1540.0797 1524.12
1508.5199 1492.8002 1477.1998 1458.2401 1435.0797 1412.04
1389.12 1366.32 1343.7599 1321.4401 1299.12 1277.1602
1255.0797 1233.3602 1211.7599 1190.28 1169.0399 1147.9202
1127.0399 1106.28 1085.6399 1065.12 1044.84 1024.0798
1001.16 978.4799 955.92017 933.4799 911.4001 889.44
867.5999 846.12006 824.6399 803.4001 782.5201 761.75995
741.12006 720.84 700.6801 680.64 660.84 641.27997
621.84 602.76 583.8 564.84 546.2399 527.87994
507.12003 486.12003 465.48007 444.84006 424.68005 404.76004
384.96008 365.51993 346.31995 327.24 ]
%% Cell type:code id: tags:
``` python
import matplotlib.pyplot as plt
import seaborn as sns
sns.set_theme(style="darkgrid")
sns.lineplot(x=aide_logement_base_ressources, y=apl)
plt.xlabel("base de ressources")
plt.ylabel("APL")
# plt.legend()
plt.show()
```
%% Output
%% Cell type:code id: tags:
``` python
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment