Skip to content

FluveFV/P4-ImpattoAzioni_public

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

P4-Impatto Azioni

Stima causale (controllo sintetico) dell'impatto di un'organizzazione sulla popolazione locale. Data una variabile che rappresenta il cambiamento nella popolazione locale, si stimano gli effetti per dati presenti nel dataset. Sono attualmente supportate le analisi su Comuni.

Requisiti:

I requisiti si possono trovare in requirements.

⚠️synthdid⚠️ è una versione locale leggermente modificata del pacchetto attualmente presente in pip. Entrambi le versioni funzionano, ma quella locale migliora la visualizzazione storica della stima. È possibile installare il pacchetto nel seguente modo:

pip install git+https://github.com/FluveFV/synthdid.py.git 

Dati

Il dataset principale è stato composto da IRVAPP, che ha estratto da ISTAT e da dati del Family Audit. Sono attualmente supportati i dati del Family Audit. Nella tabella seguente le principali informazioni sul dataset.

Unità di analisi Periodo storico Luogo Come è rappresentato Variabili in uso
Comune 1992-2022 Provincia Autonoma di Trento Dataset longitudinale
  • codicecomune: str, nome del comune (o codice)
  • year: int
  • tas_mean: float, (Y) tasso di nascite medio per anno
  • mig_mean: float, (Y) migrazione media per anno
  • max_cert: bool, (X) presenza/assenza trattamento per causalità
  • popolomedia: float, (C) popolazione media residente

Attualmente, è possibile ottenere stime causali separate sull'impatto delle azioni di un'organizzazione su due variabili: natalità e migrazione.

Processo

Il codice in StimaImpattoComuni.py è basato sul design del progetto di IRVAPP per la stima di effetti causali nella pianificazione Family Audit e Family in Trentino, ed è stato tradotto in Python da R utilizzando il metodo di stima synthetic difference in differences, controllo sintetico delle differenze. Per maggiori informazioni su come vengono prodotti i pesi e le stime si prega di leggere Synthetic Difference in Differences (Arkhangelsky et al., 2021, arXiv) e la sua implementazione in Python da synthdid.

Per tutte le organizzioni coinvolte:

  • selezione di una organizzazione certificata e selezione di tutte le organizzazioni non certificate
  • creazione del controllo sintetico tramite le organizzazioni non certificate
  • salvataggio delle stime dell'organizzazione.

🚩Parallelizzazione del codice🚩 Su dati del Family Audit, su ogni Comune una CPU da portatile impiega attualmente circa $130$ s . Su $80$ Comuni certificati, il processo dura quasi $3$ ore. Calcoli su GPU non sono attualmente supportati dalla libreria sinthdid. La soluzione attualmente più efficace è quella di parallelizzare i calcoli. Cio è possibile perche la stima di impatto di un Comune certificato, in questo modello di valutazione, è indipendente da quella degli altri Comuni certificati.

Con un sistema CPU multi-core con processori Intel® Xeon® Gold 5215, 40 logical cores (velocità di orologio: da base $2.50$ GHz a boost $3.40$ GHz) si impiegano circa $14$ minuti.

Dopo aver prodotto i risultati, il codice in AzioniImpattanti.py seleziona i dati con impatto positivo e statisticamente significativi, per $\alpha = 0.9 $. Quindi vengono estratti i Comuni con più impatto e significatività, e di seguito vengono estratte le loro azioni dai dati dei piani Comunali. Infine, tramite un'aggregazione sul sottoinsieme dei Comuni significativi, viene stilata una tabella contenente le categorie, ordinate per frequenza, delle azioni associate. Queste rappresentano le azioni più impattanti, associate ai Comuni che hanno dimostrato un impatto positivo e significativo.

Risultati

Esempio di grafico: divergenza post e pre trattamento con controllo sintentico per il Comune di Giustino. La linea verticale tratteggiata segna pre e post certificazione Family Audit.

Divergenza post e pre trattamento con controllo sintentico per il Comune di Giustino

Di seguito, le prime tre voci della tassonomia più impattanti sulle **nascite** per frequenza. La lista di Comuni è troncata per sintesi.
Voce della tassonomia Frequenza Comuni che ne hanno fatto uso
30 129 Giustino, Canal San Bovo, Bondone, ...
29 81 Castel Condino, Bocenago, Pieve Tesino ...
132 79 Canal San Bovo, Bondone, Castel Condino ...

🇺🇸-🏴󠁧󠁢󠁥󠁮󠁧󠁿 ENGLISH

Requirements:

You can find them in requirements.

⚠️synthdid⚠️ is in a local version, slightly modified from the pip version. Both versions works, but the local improves the visualization of the impact history. You can install it in the following way:

pip install git+https://github.com/FluveFV/synthdid.py.git 

Data

The main dataset was built by IRVAPP, extracted from ISTAT and Family Audit data. Currenlty, only data from Family Audit is supported. In the following table, the main informations over the dataset:

Unit of Analysis Time period Place How it is represented Variables in use
Municipality 1992-2022 Autonomous Province of Trento Panel data
  • codicecomune: str, name of the municipality (o codice)
  • year: int
  • tas_mean: float, (Y) yearly average birth ratio
  • mig_mean: float, (Y) yearly average migration ratio
  • max_cert: bool, (X) presence/absence of Family Audit certification
  • popolomedia: float, (C) average residing population

Currently, it's possible to obtain causal estimates in a separate manner on the impact of an organization's actions over two variables: births and migration.

Process

Code in StimaImpattoComuni.py is based on the project design from IRVAPP to estimate causal effects in the Family Audit planning and Family in Trentino, and it has been translated from R to Python using the estimate method synthetic difference in differences. For more information on how weights are produced and thus the effects please read Synthetic Difference in Differences (Arkhangelsky et al., 2021, arXiv) and its Python implementation synthdid.

For all participating (certified) organizations:

  • the certified organization's data is selected and so is the data from organizations that are not certified.
  • a synthetic control is created through all non certified organizations
  • the estimates from the synthetic control is logged

🚩 Code parallelization 🚩 On Family Audit data, each Municipality on a laptop's CPU's process takes about $130$ s . Over $80$ Municipalities, the process lasts almost $3$ hours. Currently, GPU calculation are not supported from the synthdid library. The most efficient solution is to parallelize calculation on CPU. This is possible because the estimate of one certified Municipality, in this model of evaluation, is independent of the other certified Municipalities.

All computations were performed on a multi-core CPU system featuring an processor. The machine has 40 logical cores (2 sockets × 10 cores × 2 threads per core) with a base clock of 2.50 GHz and a turbo boost up to 3.40 GHz.

After having produced the results, the code in AzioniImpattanti.py selects the data with a positive impact that is statistically significant for $\alpha = 0.9 $. Then, the Municipalities with the most impact and significance are extracted, and their actions from their plans too. Ultimately, after this subset of Municipalities is aggregated, a table containing the actions, ordered by frequency, is outputted. These actions represent the most impacting, as they are associated with the Municipalities that demonstrated a positive and significant impact.

Results

Graphic example: positive divergence between before and after treatment with synthetic control for the Municipality of Giustino. The vertical dotted line separates before and after the Family Audit certification - the treatment.

Divergenza post e pre trattamento con controllo sintentico per il Comune di Giustino

Following, the most common three voices of the taxonomy associated with high impact Municipalities on the births. The list of municipalities is truncated.
Taxonomy's ID Frequency Municipalities that used it
30 129 Giustino, Canal San Bovo, Bondone, ...
29 81 Castel Condino, Bocenago, Pieve Tesino ...
132 79 Canal San Bovo, Bondone, Castel Condino ...

About

No data available in the public version. Stima causale (controllo sintetico) dell'impatto delle azioni su una data variabile per dati presenti nel dataset

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages