User Tools

Site Tools


baseline_generation

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
baseline_generation [2020/05/01 08:50] matszbaseline_generation [2022/11/07 10:23] (current) – external edit 127.0.0.1
Line 120: Line 120:
 ===Constraints relating to market balances and yields=== ===Constraints relating to market balances and yields===
  
-Closed market balances (CAPTRD eq. MBAL_) define the first set of constraints and state that the sum of imports (IMPT) and production (GROF) must be equal to the sum of feed (FEDM) and seed (SEDM) use, human consumption (HCOM), processing (INDM,PRCM,BIOF), losses (LOSM) and exports (EXPT):+Closed market balances (CAPTRD eq. MBAL_ ) define the first set of constraints and state that the sum of imports (IMPT) and production (GROF) must be equal to the sum of feed (FEDM) and seed (SEDM) use, human consumption (HCOM), processing (INDM,PRCM,BIOF), losses (LOSM) and exports (EXPT):
  
 \begin{align} \begin{align}
Line 489: Line 489:
 **Figure 11: Pork production in Hungary as an example for merging medium run and long run a priori information in the CAPRI baseline approach** **Figure 11: Pork production in Hungary as an example for merging medium run and long run a priori information in the CAPRI baseline approach**
  
-{{::figure11.png?600|Source: own elaboration}} +{{::figure_11.png?600|Source: own elaboration}} 
  
 The example has been chosen because historical trends (and Aglink-COSIMO projections) on the one hand and long run expectations differ markedly. This is not unusual because medium run forecasts often give a stronger weight to recent production trends, often indicating a stagnating or declining production in the EU, whereas the long run studies tend to focus on the global growth of food demand in the coming decades. The simple trends (filled triangles) would evidently give unreasonable, even negative forecasts after 2030. Already the imposition of constraints from relationships to other series would stabilise the projections and imply some recovery after 2030 (filled squares). The year 2020 supports from Aglink-COSIMO (not shown) produces some upward correction of the step 2 results for 2020, giving a final projection (filled circles) of about 375 ktons for pork production in Hungary. This is also the starting point for the specification of the long run support (empty circles) which is a weighted average of two components. The first is a linear interpolation to the external projection from FAO/IFPRI for 2050 (empty triangles).  The second is a nonlinear damped extrapolation of the medium run projection beyond 2020 (empty squares). Changing the weight for the first component (FAO/IFPRI support) with increasing projection horizon creates a long run target value (empty circles) that gives a smooth transition from the medium to the long run. As the final projections (filled circles) tend to follow these target values, they show a turning point in the future evolution of pork production in Hungary that ultimately reflects the consideration of increasing global demand underlying the FAO/IFPRI projections.  The example has been chosen because historical trends (and Aglink-COSIMO projections) on the one hand and long run expectations differ markedly. This is not unusual because medium run forecasts often give a stronger weight to recent production trends, often indicating a stagnating or declining production in the EU, whereas the long run studies tend to focus on the global growth of food demand in the coming decades. The simple trends (filled triangles) would evidently give unreasonable, even negative forecasts after 2030. Already the imposition of constraints from relationships to other series would stabilise the projections and imply some recovery after 2030 (filled squares). The year 2020 supports from Aglink-COSIMO (not shown) produces some upward correction of the step 2 results for 2020, giving a final projection (filled circles) of about 375 ktons for pork production in Hungary. This is also the starting point for the specification of the long run support (empty circles) which is a weighted average of two components. The first is a linear interpolation to the external projection from FAO/IFPRI for 2050 (empty triangles).  The second is a nonlinear damped extrapolation of the medium run projection beyond 2020 (empty squares). Changing the weight for the first component (FAO/IFPRI support) with increasing projection horizon creates a long run target value (empty circles) that gives a smooth transition from the medium to the long run. As the final projections (filled circles) tend to follow these target values, they show a turning point in the future evolution of pork production in Hungary that ultimately reflects the consideration of increasing global demand underlying the FAO/IFPRI projections. 
Line 587: Line 587:
 ===Data balancing=== ===Data balancing===
  
-After data preparation, data calibration for the base (currently, 2012) and simulation years (currently, 2030) take place. The main file steering the data balancing process is C:/.../CAPRI/gams/arm/data_cal.gms, which in turned is included in arm/market1.gms. +After data preparation, data calibration for the base (currently, 2012) and simulation years (currently, 2030) take place. The main file steering the data balancing process is C:/.../CAPRI/gams/arm/data_cal.gms, which in turn is included in arm/market1.gms. 
  
 //Data balancing for the base year// \\ //Data balancing for the base year// \\
Line 603: Line 603:
 \end{equation} \end{equation}
  
-where SSQ is an artificial variable to be minimized, indices RMS, XXX, BAS and i indicate, respectively, regions, commodities, base year and activities (e.g., production, processing, imports etc.), and p_weight is a parameter of weights between 1 and 100 assigned to regions and activities. These weights are necessary to achieve plausible calibrated values and their specification is the outcome of a trial and error process, inspecting results from data calibration and retrying. They depend on the results of global database and trends generation. On the right hand-side of the equation v stands for a variable to be estimated and DATA – for base year data already adjusted at the data preparation and balancing stage. Hence with this equation squared sum over regions and commodities of differences between estimated and observed values (and or quantities), these differences being scaled by the observed data times the weight parameters, is minimized. Respectively, calibrated base year data fits the system of the market equations, given certain parameter values, and resembles the observed data as closely as possible. The activities implied under the index include quantities of production, human consumption, feed, processing, processed to biofuels, import and export, producer, consumer and market prices, difference between market prices and import prices to reduce differences between physical and Armington aggregation, consolidated gap between producer and market prices, processing margin, trade flows and transport costs.+where SSQ is an artificial variable to be minimized, indices RMS, XXX, BAS and i indicate, respectively, regions, commodities, base year and activities (e.g., production, processing, imports etc.), and p_weight is a parameter of weights between 1 and 100 assigned to regions and activities. These weights are necessary to achieve plausible calibrated values and their specification is the outcome of a trial and error process, inspecting results from data calibration and retrying. They depend on the results of global database and trends generation. On the right hand-side of the equation v stands for a variable to be estimated and DATA – for base year data already adjusted at the data preparation and balancing stage. Hence with this equation squared sum over regions and commodities of differences between estimated and observed values (and or quantities), these differences being scaled by the observed data times the weight parameters, is minimized. Respectively, calibrated base year data fits the system of the market equations, given certain parameter values, and resembles the observed data as closely as possible. The activities implied under the index include quantities of production, human consumption, feed, processing, processed to biofuels, import and export, producer, consumer and market prices, difference between market prices and import prices to reduce differences between physical and Armington aggregation, consolidated gap between producer and market prices, processing margin, trade flows and transport costs.
  
 The process of model solving is navigated with C:/.../CAPRI/gams/arm/data_fit.gms file. Its main function is to assure model solving by keeping the market balances closed and price system consistent. Because of the very large number of equations with the exact similar number of variables (36 thsds) that makes the system of equations square, as well as non-linear formulation of some of the equations, it is very likely that infeasibilities will occur during the model solving. To ensure the feasibility as far as possible, code elements such as widening of variable bounds, once they become binding, reducing non-smoothness of the functional forms and introduction of slack variables are introduced. More detailed information on this process can be found in a technical document by Wolfgang Britz and Heinz-Peter Witzke //Infeasibilities in the market model of CAPRI – how they are dealt with// at [[https://www.capri-model.org/docs/infes.pdf]]. The process of model solving is navigated with C:/.../CAPRI/gams/arm/data_fit.gms file. Its main function is to assure model solving by keeping the market balances closed and price system consistent. Because of the very large number of equations with the exact similar number of variables (36 thsds) that makes the system of equations square, as well as non-linear formulation of some of the equations, it is very likely that infeasibilities will occur during the model solving. To ensure the feasibility as far as possible, code elements such as widening of variable bounds, once they become binding, reducing non-smoothness of the functional forms and introduction of slack variables are introduced. More detailed information on this process can be found in a technical document by Wolfgang Britz and Heinz-Peter Witzke //Infeasibilities in the market model of CAPRI – how they are dealt with// at [[https://www.capri-model.org/docs/infes.pdf]].
Line 609: Line 609:
 After solving the MODEL m_calMarketBas, the calibrated data are stored, new producer prices for agricultural outputs are set, sugar beet prices as a function of – sugar market price – sugar export price (pre-reform) or ethanol market price (post-reform) – processing yield (specific to CUR to calibrate to any set of projected beet prices) – levying model for A- and B- sugar (pre-reform) are calculated, share and shift parameters of CES-functions used in the Armington approach to determine import shares as a function of import prices are defined (file C:/.../CAPRI/gams/arm/cal_armington.gms). Furthermore, energy conversion factors for animal products are defined with MODEL m_fitFeedConv (in file C:/.../CAPRI/gams/arm/feed_conv_decl.gms). After solving the MODEL m_calMarketBas, the calibrated data are stored, new producer prices for agricultural outputs are set, sugar beet prices as a function of – sugar market price – sugar export price (pre-reform) or ethanol market price (post-reform) – processing yield (specific to CUR to calibrate to any set of projected beet prices) – levying model for A- and B- sugar (pre-reform) are calculated, share and shift parameters of CES-functions used in the Armington approach to determine import shares as a function of import prices are defined (file C:/.../CAPRI/gams/arm/cal_armington.gms). Furthermore, energy conversion factors for animal products are defined with MODEL m_fitFeedConv (in file C:/.../CAPRI/gams/arm/feed_conv_decl.gms).
  
-Data balancing for the simulation year \\+//Data balancing for the simulation year// \\ 
 Aim of data calibration for the simulation year aims at generating such quantity, price and other market values (see list below) for the simulation year that they fit the system of equations of the market module and variable and parameter lower and upper bounds, as well as remain as close as possible to the values to which they are calibrated (e.g., trends, estimated with growth rates from the base year, Aglink-COSIMO values, GLOBIOM values etc.). Thus process, basically, follows similar approach as for the base year. There are, however, a few differences. The main is that the model used for calibration is MODEL m_calMarketFin. As the model for base year calibration (MODEL m_calMarketBas), it is defined in cal_models.gms file and includes similar equations of the market model with the exception of NSSQ_ equation. The latter equation is replaced by NSSQ1_. Its major difference from NSSQ_ is that DATA parameter includes not values of the base year, but values projected in trend generation step for some of the factors and values shifted to the simulation year based on assumptions or growth rates for the other factors. Thus, it is used for minimizing the differences between estimated and projected (with trend generation step or growth rates) values of the variables in question. Another difference of NSSQ1_ with NSSQ_ is that it includes the differences in intervention stock changes and excludes the differences in consumer prices and gaps between producer and market prices.  Aim of data calibration for the simulation year aims at generating such quantity, price and other market values (see list below) for the simulation year that they fit the system of equations of the market module and variable and parameter lower and upper bounds, as well as remain as close as possible to the values to which they are calibrated (e.g., trends, estimated with growth rates from the base year, Aglink-COSIMO values, GLOBIOM values etc.). Thus process, basically, follows similar approach as for the base year. There are, however, a few differences. The main is that the model used for calibration is MODEL m_calMarketFin. As the model for base year calibration (MODEL m_calMarketBas), it is defined in cal_models.gms file and includes similar equations of the market model with the exception of NSSQ_ equation. The latter equation is replaced by NSSQ1_. Its major difference from NSSQ_ is that DATA parameter includes not values of the base year, but values projected in trend generation step for some of the factors and values shifted to the simulation year based on assumptions or growth rates for the other factors. Thus, it is used for minimizing the differences between estimated and projected (with trend generation step or growth rates) values of the variables in question. Another difference of NSSQ1_ with NSSQ_ is that it includes the differences in intervention stock changes and excludes the differences in consumer prices and gaps between producer and market prices. 
  
Line 625: Line 626:
 At first, parameters for land use market are calculated based on data from FAO world food market model. Among them are land use classes, crop yields, land demand of non-crop activities, areas used for fodder and average land price, total energy use for feeding and producer price of feed. Next, starting elasticity values, as well as their lower and upper bounds are loaded (e.g., demand elasticities used in SPEL/MFSS). Finally, elasticities are trimmed. At first, parameters for land use market are calculated based on data from FAO world food market model. Among them are land use classes, crop yields, land demand of non-crop activities, areas used for fodder and average land price, total energy use for feeding and producer price of feed. Next, starting elasticity values, as well as their lower and upper bounds are loaded (e.g., demand elasticities used in SPEL/MFSS). Finally, elasticities are trimmed.
  
-Elasticities trimming is controlled by C:/.../CAPRI/gams/arm/trim_par.gms file. The elasticity groups are: for calibration of demand and supply systems, feed demand system, oilseeds crush, oil processing and dairy industry. Elasticities of supply system, oilseeds crushing, oil processing and dairy industries, as well as for feed demand, are estimated with MODEL m_trimElas. It is solved by minimising absolute squares between given and calibrated elasticities including land elasticities (FitElas_) subject to the following constraints: marginal effects from price and quantity for current elasticity estimate (Hess_), homogeneity of degree zero for elasticities in prices (HomogN_), Cholesky decomposition of marginal effects to ensure correct curvature (Chol_), Ensure that own price elasticity exceeds yield elasticity * 1.5 (YieldElas_) and elasticities for total energy and protein intake from feeding (ReqsElas_). +Elasticities trimming is controlled by C:/.../CAPRI/gams/arm/trim_par.gms file. The elasticity groups are: for calibration of demand and supply systems, feed demand system, oilseeds crush, oil processing and dairy industry. Elasticities of supply system, oilseeds crushing, oil processing and dairy industries, as well as for feed demand, are estimated with MODEL m_trimElas. It is solved by minimising absolute squares between given and calibrated elasticities including land elasticities (FitElas_) subject to the following constraints: marginal effects from price and quantity for current elasticity estimate (Hess_), homogeneity of degree zero for elasticities in prices (HomogN_), Cholesky decomposition of marginal effects to ensure correct curvature (Chol_), Ensure that own price elasticity exceeds (yield elasticity * 1.5(YieldElas_) and elasticities for total energy and protein intake from feeding (ReqsElas_). 
  
 Human consumption elasticities are estimated with MODEL m_trimDem by minimizing absolute squares between given and calibrated elasticities (FitElas_). Apart from the objective function the model includes several equations related to the definition of the demand system as Generalized Leontief, homogeniety of degree zero for elasticities in prices, additivity of income elasticities weighted with budget shares and elasticities for total calorie intake.  Human consumption elasticities are estimated with MODEL m_trimDem by minimizing absolute squares between given and calibrated elasticities (FitElas_). Apart from the objective function the model includes several equations related to the definition of the demand system as Generalized Leontief, homogeniety of degree zero for elasticities in prices, additivity of income elasticities weighted with budget shares and elasticities for total calorie intake. 
Line 637: Line 638:
 The file C:/.../CAPRI/gams/capmod/def_fert_and_requirements.gms defines animal nutrient requirements and the nutrient requirements of the crops given trend forecasted yields. In particular, feed input coefficients are defined and calibrated, days in production process of fattening are defined, and manure output is taken into consideration as an input for fertilizer calibration. Fertilizer calibration is basically a merge of trend based forecasts from the ex-post CAPREG results. The fertilizer need is calculated as a function of yield, and adjusted according to the exogenous assumptions. Furthermore, crop nutrient need factors from trends are scaled and logistic function is used to calculate average growth rate of fertilizer use. The calculations must as well comply with the fertilizer equations of the supply model. The file C:/.../CAPRI/gams/capmod/def_fert_and_requirements.gms defines animal nutrient requirements and the nutrient requirements of the crops given trend forecasted yields. In particular, feed input coefficients are defined and calibrated, days in production process of fattening are defined, and manure output is taken into consideration as an input for fertilizer calibration. Fertilizer calibration is basically a merge of trend based forecasts from the ex-post CAPREG results. The fertilizer need is calculated as a function of yield, and adjusted according to the exogenous assumptions. Furthermore, crop nutrient need factors from trends are scaled and logistic function is used to calculate average growth rate of fertilizer use. The calculations must as well comply with the fertilizer equations of the supply model.
  
-====tage IV: Initialization and test run====+====Stage IV: Initialization and test run====
  
 After the behavioural blocks of the market model are calibrated (one-by-one), the whole model should be also tested for being correctly calibrated. In essence, the test initializes the model with the data against the model was calibrated, and then executes/solves the market model. In theory, a perfectly calibrated model can be solved in one single iteration, without adjustments in the values of the model variables. That is why the iteration limit is technically set to zero (i.e. not allowing for adjustment in the model variables) for the test solve. In practice, a number of infeasibilities might exist due to the accuracy of the numerical solution. But infeasibilities stemming from rounding errors must be small, so the sum of all infeasibilities gives a good indication on the quality of the model calibration.  After the behavioural blocks of the market model are calibrated (one-by-one), the whole model should be also tested for being correctly calibrated. In essence, the test initializes the model with the data against the model was calibrated, and then executes/solves the market model. In theory, a perfectly calibrated model can be solved in one single iteration, without adjustments in the values of the model variables. That is why the iteration limit is technically set to zero (i.e. not allowing for adjustment in the model variables) for the test solve. In practice, a number of infeasibilities might exist due to the accuracy of the numerical solution. But infeasibilities stemming from rounding errors must be small, so the sum of all infeasibilities gives a good indication on the quality of the model calibration. 
Line 653: Line 654:
 ====Introduction==== ====Introduction====
  
-The supply side models of the CAPRI simulation tool are programming models with an objective function. If we want the optimal solution to coincide with the forecast procuced by the projection tools of CAPTRD, we need to ensure that first and second order optimality conditions (marginal revenues equal to marginal costs, all constraints feasible, and the solution is a maximum point) hold in the calibration point for each of the NUTS 2 or farm type models. The consequences regarding the calibration are threefold:+The supply side models of the CAPRI simulation tool are programming models with an objective function. If we want the optimal solution to coincide with the forecast produced by the projection tools of CAPTRD, we need to ensure that first and second order optimality conditions (marginal revenues equal to marginal costs, all constraints feasible, and the solution is a maximum point) hold in the calibration point for each of the NUTS 2 or farm type models. The consequences regarding the calibration are threefold:
  
   - Elements not projected so far but entering the constraints of the supply models (e.g. feed, fertilization) must be defined in such way that constraints are feasible,   - Elements not projected so far but entering the constraints of the supply models (e.g. feed, fertilization) must be defined in such way that constraints are feasible,
baseline_generation.1588323001.txt.gz · Last modified: 2022/11/07 10:23 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: CC0 1.0 Universal
CC0 1.0 Universal Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki