Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Carbon tax reform #182

Open
wants to merge 35 commits into
base: nomics-master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7c07b9a
First steps to make it work
Hervedarr31 Jun 22, 2023
cbeb5d5
add the doc for installation
Hervedarr31 Jun 22, 2023
6ed7dfe
change extension for doc file
Hervedarr31 Jun 23, 2023
17c5cf6
change to 2017 erfs data
Hervedarr31 Jun 23, 2023
423a45a
New simulation file
Hervedarr31 Jun 30, 2023
f8f9f1e
New simulation file
Hervedarr31 Jun 30, 2023
84eaec1
small changes to make it work
Hervedarr31 Jun 30, 2023
0d604b0
little change to match index
Hervedarr31 Jun 30, 2023
284ffe4
file to describe the carbon tax reform
Hervedarr31 Jun 30, 2023
e6ba869
writing a new reform and adapting simulation code
Hervedarr31 Jul 4, 2023
ad1442a
fixing reform and cleaning code
Hervedarr31 Jul 6, 2023
9d021c7
Finishing first reform with scalar elasticities
Hervedarr31 Jul 7, 2023
7f9dcd8
migrating to vectorial elasticities
Hervedarr31 Jul 7, 2023
53efe56
code to create the .csv table with elasticites from Douenne (2020)
Hervedarr31 Jul 10, 2023
7469f98
Adapt code to vectorial elasticities from Douenne (2020)
Hervedarr31 Jul 10, 2023
ab27a0c
Adapt code to vectorial elasticities from Douenne (2020)
Hervedarr31 Jul 10, 2023
e528946
Adapt code to vectorial elasticities from Douenne (2020)
Hervedarr31 Jul 10, 2023
5d89d06
Averaging the first two percentiles of revenue /uc
Hervedarr31 Jul 12, 2023
bea65dc
Script to create .csv vectorial elasticities
Hervedarr31 Jul 18, 2023
ee56ca6
graph weighted boxplots
Hervedarr31 Jul 18, 2023
e907614
Solve issue with weighted boxplots
Hervedarr31 Jul 21, 2023
fced494
transfered graph function to a dedicated file
Hervedarr31 Jul 21, 2023
c607a3e
Compute CO2 emissions in the simulation and graph
Hervedarr31 Jul 24, 2023
d99a7b8
finishing with CO2 emissions
Hervedarr31 Jul 26, 2023
ea0f918
Finalize first part
Hervedarr31 Jul 27, 2023
7f19b22
Net transfers per cu + graphs
Hervedarr31 Jul 28, 2023
b4f73c1
Add extensive margin elasticities
Hervedarr31 Aug 10, 2023
590cf9e
Adapt old codes to extensive margin elasticities
Hervedarr31 Aug 11, 2023
1041f5c
Extensive margin
Hervedarr31 Aug 11, 2023
6b9e38b
Last modification, desc stats
Hervedarr31 Aug 22, 2023
1f64b3f
wrote Readme file
Hervedarr31 Aug 23, 2023
4dd8e52
correct error and rerun
Hervedarr31 Aug 30, 2023
88cfd72
Finalization
Hervedarr31 Dec 3, 2023
8da2ad6
reinitializing path
Hervedarr31 Dec 3, 2023
d7640a3
Cleaning Install file
Hervedarr31 Dec 3, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions Install openfisca-france-indirect-taxation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
**Fork le repo indirect-taxation**

- gh repo fork https://github.com/openfisca/openfisca-france-indirect-taxation

** Cloner le repo indirect-taxation** (plus précisément la branche nomics-master qui nous intéresse)

- git clone -b 'nomics-master' 'https://github.com/Hervedarr31/openfisca-france-indirect-taxation.git'

**Créer et configurer un nouvel environnement virtuel**

-(avec pyenv et pip):
- `py -3.9 -m venv hervenv`
- `hervenv\Scripts\activate`
- Installer openfisca-france-indirect-taxation :
- se placer dans le dossier openfisca-france-indirect-taxation
- `pip install -e .`
- normalement les autres packages nécessaire sont importés dans les bonnes versions
( OpenFisca-Core==35.12.0 et OpenFisca-Survey-Manager==0.47.2)

-(avec conda et le fichier environment.yml du git nomics-master):

- se placer dans le dossier openfisca-france-indirect-taxation
- modifier le fichier environment.yml pour indiquer le nom (name: openfiscaenv) et le chemin (ex: prefix : C:\Users\veve1\miniconda3\envs)
- conda env create -f environment.yml
- Installer openfisca-france-indirect-taxation :
- se placer dans le dossier openfisca-france-indirect-taxation
- `pip install -e .`


**Configurer le chemin des données sources**

- Aller dans le sous-dossier nommé `runner` du repo Openfisca-France-Indirect-Taxation.
- Copier les fichiers `openfisca_survey_manager_config` et `openfisca_survey_manager_raw_data` et les coller dans son dossier `\.config` (dans C:\Users\veve1\.config) au sein d'un sous-dossier à nommer `openfisca-survey-manager`.
- Renommer les deux fichiers respectivement `config` et `raw_data`.
- S'assurer que l'extension des fichiers est bien .ini
- Dans le fichier `raw_data`, renseigner le chemin des données sources indiquées (BDF, EL, ET, ERFS FPR).
Toutes ces données sont présentes dans le dossier (C:\Users\veve1\OneDrive\Documents\ENSAE 3A\Memoire MiE\Data). Supprimer les lignes correspondantes aux données "aliss".
- Créer un dossier `data_collections` à l'endroit souhaité (ex : `C:\Users\veve1\OneDrive\Documents\ENSAE 3A\Memoire MiE\Data\data_collections`) ainsi que deux sous-dossiers à l'intérieur nommés `tmp` et `output`.
- Dans le fichier `config`, renseigner les chemins de ces dossiers aux lignes correspondantes.<br><br>


**Construire les collections**

Depuis le dossier "openfisca-france-indirect-taxation", lancer les scripts suivants :
- `build-collection -c budget_des_familles -d -m -s 2011`
- `build-collection -c budget_des_familles -d -s 2017` #on a retiré le -m pour que le fichiers de métadonnées soit complété et non écrasé

- `build-collection -c enquete_logement -d -m -s 2006`
- `build-collection -c enquete_logement -d -s 2013` #on a retiré le -m pour que le fichiers de métadonnées soit complété et non écrasé


- `build-collection -c enquete_transports -d -m -s 2008`
- `build-collection -c enquete_transports -d -s 2019` #on a retiré les -m pour que le fichiers de métadonnées soit complété et non écrasé


- `build-collection -c erfs_fpr -d -m -s 2015`
- `build-collection -c erfs_fpr -d -s 2017`#on a retiré les -m pour que le fichiers de métadonnées soit complété et non écrasé

Lors de l'exécution de ces scripts, éventuellement prendre garde aux problèmes de chemin d'accès aux répertoires de données.
!!! Le module gère les espaces mais pas les accents !!!
Pour la doc : https://pypi.org/project/OpenFisca-Survey-Manager/0.47.2/

**Construire les données**
- Lancer le script `openfisca_france_indirect_taxation\scripts\build_survey_data.py`
- Légère modification dans l'enquête logement : renommer le fichier MENLOG_DIFF en menlog_diff
- Quelques modifications des scripts que j'ai du faire:
- openfisca-france-indirect-taxation\openfisca_france_indirect_taxation\build_survey_data\step_5_data_from_matching.py :
ligne 43, platform.system() (les parenthèses n'y étaient pas)
- dans le fichier .config/openfisca-survey-manager/config.ini :
rajouter les lignes
[exe]
r_libs_user = C:\Users\veve1\AppData\Local\R\win-library\4.3
rscript = C:\Program Files\R\R-4.3.0\bin\Rscript.exe

- openfisca-france-indirect-taxation\openfisca_france_indirect_taxation\build_survey_data\matching_erfs\step_1_build_dataframes.py :
ligne 16 year_erfs = 2017
ligne 23 (table = 'fpr_menage_2017')
ligne 24 (table = 'fpr_mrf17e17t4')
Simplement pour utiliser les données ERFS 2017 au lieu de 2013

- dans tous les scripts .R de openfisca-france-indirect-taxation\openfisca_france_indirect_taxation\assets\matching:
remplacer les chemins en ('~/') par les chemins complets ('C:/Users/...')
- openfisca-france-indirect-taxation\openfisca_france_indirect_taxation\build_survey_data\matching_bdf_entd\step_2_homogenize_variables.py :
ligne 129 (niveau_vie_quintile) : il restait un niveau_vie_decile à remplacer par niveau_vie_quintile
- openfisca-france-indirect-taxation\openfisca_france_indirect_taxation\surveys.py :
déplacer la ligne `survey_scenario.initialize_weights()`

4 changes: 2 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: fiscalite_indirecte
name: openfiscaenv
channels:
- defaults
dependencies:
Expand Down Expand Up @@ -217,4 +217,4 @@ dependencies:
- weightedcalcs==0.1.2
- wmctrl==0.4
- wquantiles==0.6
prefix: C:\Users\c.lallemand\.conda\envs\fiscalite_indirecte
prefix: C:\Users\veve1\miniconda3\envs
Original file line number Diff line number Diff line change
@@ -1,117 +1,117 @@
loyer_impute,1.3705966261289382,2011
depenses_electricite,1.1123754146020817,2011
depenses_gaz_ville,1.5096127816073226,2011
depenses_combustibles_liquides,1.5308685381500458,2011
depenses_combustibles_solides,1.2050390283658854,2011
depenses_carburants,1.1039672695542464,2011
depenses_tot,1.2707961552308173,2011
rev_disponible,1.4429859121265207,2011
rev_disp_loyerimput,1.1277692906497165,2011
depenses_gaz_liquefie,1.5096127816073226,2011
depenses_diesel,1.1039672695542464,2011
depenses_essence,1.1039672695542464,2011
revtot,1.4429859121265207,2011
loyer_impute,1.4145210896094844,2012
depenses_electricite,1.2438755171757327,2012
depenses_gaz_ville,1.6345090765384598,2012
depenses_combustibles_liquides,1.7146656703283385,2012
depenses_combustibles_solides,1.201658370555319,2012
depenses_carburants,1.140172158911232,2012
depenses_tot,1.2853325824740642,2012
rev_disponible,1.4574612143145158,2012
rev_disp_loyerimput,1.1357018393983587,2012
depenses_gaz_liquefie,1.6345090765384598,2012
depenses_diesel,1.140172158911232,2012
depenses_essence,1.140172158911232,2012
revtot,1.4574612143145158,2012
loyer_impute,1.4537477398518701,2013
depenses_electricite,1.345929765125562,2013
depenses_gaz_ville,1.769321942043223,2013
depenses_combustibles_liquides,1.5864560091388822,2013
depenses_combustibles_solides,1.38792631956344,2013
depenses_carburants,1.0972034081004096,2013
depenses_tot,1.3011237056353988,2013
rev_disponible,1.4497936489793777,2013
rev_disp_loyerimput,1.1244985867371504,2013
depenses_gaz_liquefie,1.769321942043223,2013
depenses_diesel,1.0972034081004096,2013
depenses_essence,1.0972034081004096,2013
revtot,1.4497936489793777,2013
loyer_impute,1.4823894114260716,2014
depenses_electricite,1.2903745465996819,2014
depenses_gaz_ville,1.4510771695473093,2014
depenses_combustibles_liquides,1.3169066989403424,2014
depenses_combustibles_solides,1.5249172255806283,2014
depenses_carburants,1.0575088104622405,2014
depenses_tot,1.3131442631017747,2014
rev_disponible,1.468876497933728,2014
rev_disp_loyerimput,1.1382346715862834,2014
depenses_gaz_liquefie,1.4510771695473093,2014
depenses_diesel,1.0575088104622405,2014
depenses_essence,1.0575088104622405,2014
revtot,1.468876497933728,2014
loyer_impute,1.5055721962558577,2015
depenses_electricite,1.3945472013569804,2015
depenses_gaz_ville,1.443970318189655,2015
depenses_combustibles_liquides,1.086645214366492,2015
depenses_combustibles_solides,1.5571795824848569,2015
depenses_carburants,0.9756784762003746,2015
depenses_tot,1.3344181822541437,2015
rev_disponible,1.4852049738782258,2015
rev_disp_loyerimput,1.1501365469380433,2015
depenses_gaz_liquefie,1.443970318189655,2015
depenses_diesel,0.9756784762003746,2015
depenses_essence,0.9756784762003746,2015
revtot,1.4852049738782258,2015
loyer_impute,1.5260677733447854,2016
depenses_electricite,1.4489902563089392,2016
depenses_gaz_ville,1.496786220557063,2016
depenses_combustibles_liquides,1.0022733903510286,2016
depenses_combustibles_solides,1.5768443878628913,2016
depenses_carburants,0.9509522921978825,2016
depenses_tot,1.3618175330851263,2016
rev_disponible,1.5117863979500417,2016
rev_disp_loyerimput,1.1714437510239935,2016
depenses_gaz_liquefie,1.496786220557063,2016
depenses_diesel,0.9509522921978825,2016
depenses_essence,0.9509522921978825,2016
revtot,1.5117863979500417,2016
loyer_impute,1.5489605655500205,2017
depenses_electricite,1.4407814299299957,2017
depenses_gaz_ville,1.4526087375989516,2017
depenses_combustibles_liquides,1.2122078531279084,2017
depenses_combustibles_solides,1.5955163066346705,2017
depenses_carburants,1.0326506470202648,2017
depenses_tot,1.3938488523943549,2017
rev_disponible,1.5503841210814513,2017
rev_disp_loyerimput,1.2031524519803853,2017
depenses_gaz_liquefie,1.4526087375989516,2017
depenses_diesel,1.0326506470202648,2017
depenses_essence,1.0326506470202648,2017
revtot,1.5503841210814513,2017
loyer_impute,1.576840880335594,2018
depenses_electricite,1.4783301905923876,2018
depenses_gaz_ville,1.4782989723622797,2018
depenses_combustibles_liquides,1.5022014544886026,2018
depenses_combustibles_solides,1.6071338871527392,2018
depenses_carburants,1.1612469965743724,2018
depenses_tot,1.4300985296023405,2018
rev_disponible,1.596809665439816,2018
rev_disp_loyerimput,1.2412532212319902,2018
depenses_gaz_liquefie,1.4782989723622797,2018
depenses_diesel,1.1612469965743724,2018
depenses_essence,1.1612469965743724,2018
revtot,1.596809665439816,2018
loyer_impute,1.6102171387410447,2019
depenses_electricite,1.5199039241889707,2019
depenses_gaz_ville,1.515172973920927,2019
depenses_combustibles_liquides,1.4720451096190557,2019
depenses_combustibles_solides,1.6697559719116486,2019
depenses_carburants,1.1726815956894496,2019
depenses_tot,1.4657031153099314,2019
rev_disponible,1.6459759898738016,2019
rev_disp_loyerimput,1.281171978289918,2019
depenses_gaz_liquefie,1.515172973920927,2019
depenses_diesel,1.1726815956894496,2019
depenses_essence,1.1726815956894496,2019
revtot,1.6459759898738016,2019
loyer_impute,1.1462185135443184,2011
depenses_electricite,0.8895062787406351,2011
depenses_gaz_ville,1.468208427900848,2011
depenses_combustibles_liquides,2.167933322359766,2011
depenses_combustibles_solides,0.941929756377857,2011
depenses_carburants,1.2334963012982472,2011
depenses_tot,1.1725436077072195,2011
rev_disponible,1.3101040990360564,2011
rev_disp_loyerimput,1.014184462910861,2011
depenses_gaz_liquefie,1.468208427900848,2011
depenses_diesel,1.2334963012982472,2011
depenses_essence,1.2334963012982472,2011
revtot,1.3101040990360564,2011
loyer_impute,1.1829521755708343,2012
depenses_electricite,0.9946597776033754,2012
depenses_gaz_ville,1.589679175277697,2012
depenses_combustibles_liquides,2.428216891767363,2012
depenses_combustibles_solides,0.9392872343408556,2012
depenses_carburants,1.273949128426705,2012
depenses_tot,1.1859561402938281,2012
rev_disponible,1.323246398328037,2012
rev_disp_loyerimput,1.0213180741546297,2012
depenses_gaz_liquefie,1.589679175277697,2012
depenses_diesel,1.273949128426705,2012
depenses_essence,1.273949128426705,2012
revtot,1.323246398328037,2012
loyer_impute,1.2157570956144068,2013
depenses_electricite,1.0762670238009189,2013
depenses_gaz_ville,1.7207945101073427,2013
depenses_combustibles_liquides,2.24665329579918,2013
depenses_combustibles_solides,1.0848852769769903,2013
depenses_carburants,1.2259388325979566,2013
depenses_tot,1.2005263610527799,2013
rev_disponible,1.3162849244212074,2013
rev_disp_loyerimput,1.0112431724196158,2013
depenses_gaz_liquefie,1.7207945101073427,2013
depenses_diesel,1.2259388325979566,2013
depenses_essence,1.2259388325979566,2013
revtot,1.3162849244212074,2013
loyer_impute,1.2397098863854803,2014
depenses_electricite,1.0318425291142437,2014
depenses_gaz_ville,1.4112782799808357,2014
depenses_combustibles_liquides,1.8649321244276191,2014
depenses_combustibles_solides,1.191965469147806,2014
depenses_carburants,1.181586847970755,2014
depenses_tot,1.211617540200797,2014
rev_disponible,1.333610470309273,2014
rev_disp_loyerimput,1.0235958086819406,2014
depenses_gaz_liquefie,1.4112782799808357,2014
depenses_diesel,1.181586847970755,2014
depenses_essence,1.181586847970755,2014
revtot,1.333610470309273,2014
loyer_impute,1.2590974557555188,2015
depenses_electricite,1.1151437503236719,2015
depenses_gaz_ville,1.4043663491954876,2015
depenses_combustibles_liquides,1.5388482492786009,2015
depenses_combustibles_solides,1.2171836349197351,2015
depenses_carburants,1.0901553196730305,2015
depenses_tot,1.231246650511144,2015
rev_disponible,1.3484352881305177,2015
rev_disp_loyerimput,1.0342989703669894,2015
depenses_gaz_liquefie,1.4043663491954876,2015
depenses_diesel,1.0901553196730305,2015
depenses_essence,1.0901553196730305,2015
revtot,1.3484352881305177,2015
loyer_impute,1.2762377357308565,2016
depenses_electricite,1.1586789081291076,2016
depenses_gaz_ville,1.455733662673354,2016
depenses_combustibles_liquides,1.4193654300860172,2016
depenses_combustibles_solides,1.2325548095480525,2016
depenses_carburants,1.062528000137906,2016
depenses_tot,1.2565276002055195,2016
rev_disponible,1.3725688796937097,2016
rev_disp_loyerimput,1.0534601902292469,2016
depenses_gaz_liquefie,1.455733662673354,2016
depenses_diesel,1.062528000137906,2016
depenses_essence,1.062528000137906,2016
revtot,1.3725688796937097,2016
loyer_impute,1.2953827866905072,2017
depenses_electricite,1.1521147549580546,2017
depenses_gaz_ville,1.4127678415086142,2017
depenses_combustibles_liquides,1.7166632750830024,2017
depenses_combustibles_solides,1.247149885297308,2017
depenses_carburants,1.1538120637825198,2017
depenses_tot,1.286082394298867,2017
rev_disponible,1.407612212315993,2017
rev_disp_loyerimput,1.0819753059676198,2017
depenses_gaz_liquefie,1.4127678415086142,2017
depenses_diesel,1.1538120637825198,2017
depenses_essence,1.1538120637825198,2017
revtot,1.407612212315993,2017
loyer_impute,1.3186988611368056,2018
depenses_electricite,1.1821404620437104,2018
depenses_gaz_ville,1.437753466732395,2018
depenses_combustibles_liquides,2.127336547146383,2018
depenses_combustibles_solides,1.2562308731570322,2018
depenses_carburants,1.2974966873307308,2018
depenses_tot,1.3195294008205023,2018
rev_disponible,1.4497625170783177,2018
rev_disp_loyerimput,1.1162387040937274,2018
depenses_gaz_liquefie,1.437753466732395,2018
depenses_diesel,1.2974966873307308,2018
depenses_essence,1.2974966873307308,2018
revtot,1.4497625170783177,2018
loyer_impute,1.346611147339652,2019
depenses_electricite,1.2153847216519467,2019
depenses_gaz_ville,1.4736161200686977,2019
depenses_combustibles_liquides,2.084630760663719,2019
depenses_combustibles_solides,1.3051799973367044,2019
depenses_carburants,1.3102729136775235,2019
depenses_tot,1.3523811915696777,2019
rev_disponible,1.4944012087205498,2019
rev_disp_loyerimput,1.152136988895879,2019
depenses_gaz_liquefie,1.4736161200686977,2019
depenses_diesel,1.3102729136775235,2019
depenses_essence,1.3102729136775235,2019
revtot,1.4944012087205498,2019
Expand Down
Loading