Closed mishkos closed 4 years ago
has this been fixed yet?
I do not understand the issue, and miskos answer..
ok, this is the issue:
a=FoodExpenditure("../../inputdata/fulldata.gdx")[,2050,] sum(a) [1] 7855.305 b=consumptionValue("../../inputdata/fulldata.gdx", type="food")[,"y2050",] sum(b) [1] 5660919
the food expenditure function calculates expenditure based on calories and calorie-prices: price = readGDX(gdx,"p15_prices_kcal") which in the gams code is the equation
p15_prices_kcal(t,iso,kfo)=sum(i_to_iso(i,iso), q15_food_demand.m(i,kfo)); q15_food_demand(i2,kfo) .. (vm_dem_food(i2,kfo) + sum(ct, f15_household_balanceflow(ct,i2,kfo,"dm")))
the consumption value function receives its prices from the equation: d <- readGDX(gdx,"ov_supply",select = list(type="level"),react = "warning") and the quantities from the variable readGDX(gdx, "ov_dem_food", select=list(type="level"))
So i see one bug in the food expenditure function, because it omits the multiplication by 365. This still does not close the gap (still ~50%)
ah, no. the multiplication by 365 is done.
ah, the food expenditure is by default as per-capita. if you switch it to per-capita = FALSE, it provides similar values as the consumption value
a = FoodExpenditure(gdx,per_capita=FALSE)[,2050,]
sum(a) [1] 5787212
b=consumptionValue("../../inputdata/fulldata.gdx", type="food")[,"y2050",] sum(b) [1] 5660919
so everything is fine, no bugs :)
Ideally this should be the same. For the difference between the output of
FoodExpenditure()
andconsumptionValue(..., type="food")
, it basically comes from usage of different approaches for calculation of prices and quantities, the former using prices per kcal and caloric intake and the latter using prices per tones DM and tDM consumption. Since prices in both case are calculated as Lagrangian multipliers, it could be that the difference in output of functions comes from a general equation system setup in magpie and related interplay between demand variables.