openfisca / openfisca-core

OpenFisca core engine. See other repositories for countries-specific code & data.
https://openfisca.org
GNU Affero General Public License v3.0
168 stars 75 forks source link

Recognise reform tuples as reforms #1084

Open nikhilwoodruff opened 2 years ago

nikhilwoodruff commented 2 years ago

One of the features we've implemented for the UK and US models is the ability of a simulation to recognise a tuple of reforms as a reform. I wonder whether this could be useful to other country models as an openfisca-supported feature? The main advantage of this is that it makes programming per-provision analyses much simpler and easier. For example, this chart shows the distributional impacts of each provision of a reform: image This is pretty simple to generate because we can iteratively slice reforms before using them to reform tax-benefit systems.

benjello commented 2 years ago

@nikhilwoodruff : you do chain reforms right ?

If my reform contain two provisions A and B I first compute the impact of A on my outcome (net income) as (reference + A) - (reference) the impact of B as (reference + A + B) - (reference + A).

(X) means the outcome in the situation X.

If this is the case, then the order of reforms can be important.

nikhilwoodruff commented 2 years ago

Yes - so e.g. for a 3-part reform (A, B, C) we'd run: Impact of A = impact((A,)) - impact(()) Impact of B = impact((A, B)) - impact((A,)) Impact of C = impact((A, B, C)) - impact((A, B))

benjello commented 2 years ago

It is a good idea. But with a huge data, it may be tricky to in RAM all the data needed to compute the impacts at individual level. It will be difficult to go beyond a sequential computation.

nikhilwoodruff commented 2 years ago

True, though we solved that memory issue by only dealing with one simulation at a time: get the summary metrics (budgetary impact, etc) out of each partial reform, then discard and move onto the next slice.

benjello commented 2 years ago

So you have to know beforehand all the metrics you want to compute and run all the simulations sequentially. W thus need to fin a way to pass a list of metrics and a tuple of reforms to produce an impact analysis. This would be a very nice improvement of the simple interactive/imperatve tools that come with openfisca-survey-manager.