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

Elastic Food Demand and Tax recycling #767

Merged
merged 18 commits into from
Feb 8, 2025
Merged

Conversation

bodirsky
Copy link
Member

@bodirsky bodirsky commented Jan 17, 2025

🐦 Description of this PR 🐦

  • Bugfix of the price iteration between magpie and demand module

image

  • Introduced Tax recycling. Revenue from greenhouse gas taxation is recycled to consumers as per-capita premium to income.

🔧 Checklist for PR creator 🔧

  • Label pull request from the label list.

    • Low risk: Simple bugfixes (missing files, updated documentation, typos) or changes in start or output scripts
    • Medium risk: Uncritical changes in the model core (e.g. moderate modifications in non-default realizations)
    • High risk: Critical changes in model core or default settings (e.g. changing a model default or adjusting a core mechanic in the model)
  • Self-review own code

    • No hard coded numbers and cluster/country/region names.
    • The new code doesn't contain declared but unused parameters or variables.
    • magpie4 R library has been updated accordingly and backwards compatible where necessary.
    • scenario_config.csv has been updated accordingly (important if default.cfg has been updated)
  • Document changes

    • Add changes to CHANGELOG.md
    • Where relevant, put In-code documentation comments
    • Properly address updates in interfaces in the module documentations
    • run goxygen::goxygen() and verify the modified code is properly documented
  • Perform test runs

    • Low risk:

      • Run a compilation check via Rscript start.R --> "compilation check"
    • Medium risk:

      • Run test runs via Rscript start.R --> "test runs"
      • Check logs for errors/warnings
    • High risk:

      • Run test runs via Rscript start.R --> "test runs"
      • Check logs for errors/warnings
      • Default run from the PR target branch for comparison
      • Provide relevant comparison plots (land-use, emissions, food prices, land-use intensity,...)

      test run scenario setup:
      3 taxation scenarios with full tax recycling (1), medium (0.5) and none (0)
      A scenario without taxation (Ref-1)
      A scenario without taxation and without elastic demand (Ref-inelastic)

image
total calories: no major changes
image
image
some changes in ruminant meat consumption in SSA
Taxation with tax recycling has almost no effect, only if taxes are not recycled consumption declines

image
food expenditure rises in taxation scenarios.
Price drop in 2025, as the model switches from exogenous prices to endogenous prices in the elastic version of the model. Drop would be lower if our prices would be more realistic.

📉 Performance changes 📈

  • Current develop branch default : ** mins
  • This PR's default : ** mins

🚨 Checklist for reviewer 🚨

  • PR is labeled correctly
  • Code changes look reasonable
    • No hard coded numbers and cluster/country/region names.
    • No unnecessary increase in module interfaces
    • model behavior/performance is satisfactory.
  • Changes are properly documented
    • CHANGELOG is updated correctly
    • Updates in interfaces have been properly addressed in the module documentations
    • In-code documentation looks appropriate
  • content review done (at least 1)
  • RSE review done (at least 1)

removed all realization of food demand module, as it is outdated.
…develop

# Please enter a commit message to explain why this merge is necessary,
# especially if it merges an updated upstream into a topic branch.
#
# Lines starting with '#' will be ignored, and an empty message aborts
# the commit.
@xwangatpik
Copy link
Member

The bugfixing for elastic demand looks good to me and Jiaqi.

@flohump flohump requested a review from xwangatpik February 3, 2025 19:40
@flohump
Copy link
Contributor

flohump commented Feb 3, 2025

The bugfixing for elastic demand looks good to me and Jiaqi.

Thanks for looking into it!
Can you add a review and approve (or request changes)?

Copy link
Contributor

@flohump flohump left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for these improvement.
Looks fine overall.
Please mention in the CHANGELOG that you removed modules/15_food/anthropometrics_jan18
You changed 3 renv files. Please double check

modules/16_demand/sector_may15/input.gms Show resolved Hide resolved
renv/settings.dcf Show resolved Hide resolved
CHANGELOG.md Show resolved Hide resolved
modules/15_food/anthropometrics_jan18 deleted
@bodirsky bodirsky requested a review from flohump February 4, 2025 11:39
Copy link
Contributor

@flohump flohump left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying.
Before you proceed you need to sort out merging conflicts.

Copy link
Contributor

@deleip deleip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, just two small questions

modules/15_food/anthro_iso_jun22/presolve.gms Show resolved Hide resolved
main.gms Outdated Show resolved Hide resolved
bodirsky and others added 3 commits February 7, 2025 08:17
…develop

# Conflicts:
#	CHANGELOG.md
#	modules/15_food/anthropometrics_jan18/declarations.gms
#	modules/15_food/anthropometrics_jan18/equations.gms
#	modules/15_food/anthropometrics_jan18/input.gms
#	modules/15_food/anthropometrics_jan18/intersolve.gms
#	modules/15_food/anthropometrics_jan18/postsolve.gms
#	modules/15_food/anthropometrics_jan18/preloop.gms
#	modules/15_food/anthropometrics_jan18/presolve.gms
#	modules/15_food/anthropometrics_jan18/realization.gms
#	modules/15_food/anthropometrics_jan18/scaling.gms
#	modules/15_food/anthropometrics_jan18/sets.gms
renv/settings.json Outdated Show resolved Hide resolved
renv/.gitignore Outdated Show resolved Hide resolved
main.gms Outdated Show resolved Hide resolved
modules/15_food/anthro_iso_jun22/input.gms Outdated Show resolved Hide resolved
CHANGELOG.md Show resolved Hide resolved
Copy link
Contributor

@weindl weindl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you.

config/default.cfg Outdated Show resolved Hide resolved
@@ -178,6 +175,11 @@ parameters
* country-specific scenario switch
p15_country_switch(iso) Switch indicating whether country is affected by diet scenarios (1)

* elastic demand
p15_tax_recycling(t,iso) Tax revenue recycling to households (USD17PPP per capita)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name of the switch 's15_tax_recycling' that determines how GHG tax revenues are recycled is very similar to the name of the parameter 'p15_tax_recycling(t,iso)'.
Would it be an idea to rename one of them to make the code easier to read?

@bodirsky bodirsky requested a review from pascal-sauer February 7, 2025 16:02
@bodirsky bodirsky dismissed pascal-sauer’s stale review February 8, 2025 09:23

all requested changes done. now want to merge

@bodirsky bodirsky merged commit 92eff0d into magpiemodel:develop Feb 8, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants