suaFilling: This function replaces the old BalanceResidual

Description Usage Arguments Details Value

View source: R/suaFilling.R

Description

This function forces a the filling of empty elements in the pulled SUA by allocating the "imbalance" according to a Ranking of the possible Uitlizazions for each combination of country/commodity.

This function forces a the filling of empty elements in the pulled SUA by allocating the "imbalance" according to a Ranking of the possible Uitlizazions for each combination of country/commodity.

Usage

1
2
3
4
5
6
7
suaFilling(data, p = p, tree = tree, primaryCommodities = c(),
  stockCommodities = c(), debugFile = NULL, utilizationTable = c(),
  imbalanceThreshold = 10, loop1 = TRUE)

suaFilling(data, p = p, tree = tree, primaryCommodities = c(),
  stockCommodities = c(), debugFile = NULL, utilizationTable = c(),
  imbalanceThreshold = 10, loop1 = TRUE)

Arguments

data

The data.table containing the full dataset for standardization.

p

The parameters for standardization. These parameters provide information about the columns of data and tree, specifying (for example) which columns should be standardized, which columns represent parents/children, etc.

tree

this is the sub tree used in the function.

primaryCommodities

Primary level commodities (such as wheat, oranges, sweet potatoes, etc.) should not be balanced at this step but rather by the balancing algorithm. This argument allows the user to specify a character vector with these primary element codes.

stockCommodities

This list specify if the commodity can be allocated to stock

utilizationTable

is the external utilizataion table

imbalanceThreshold

The size that the imbalance must be in order for an adjustment to be made.

loop1

insicates if is the firs or second loop before or after the food Proc calculation

cut

these are primary equivalent commodities.

data

The data.table containing the full dataset for standardization.

p

The parameters for standardization. These parameters provide information about the columns of data and tree, specifying (for example) which columns should be standardized, which columns represent parents/children, etc.

primaryCommodities

Primary level commodities (such as wheat, oranges, sweet potatoes, etc.) should not be balanced at this step but rather by the balancing algorithm. This argument allows the user to specify a character vector with these primary element codes.

stockCommodities

This list specify if the commodity can be allocated to stock

utilizationTable

is the external utilizataion table

imbalanceThreshold

The size that the imbalance must be in order for an adjustment to be made.

cut

these are primary equivalent commodities.

tree

this is the sub tree used in the function.

loop1

insicates if is the firs or second loop before or after the food Proc calculation

Details

1. PRODUCTION OF DERIVERD Production of derived commodities is created, when is not estimated via the sub-module of derived and when utilization are higher than supplies.

2. FOOD PROCESSING with all productions, food processing is created for all parent commoditeis

3. ALL OTHER ELEMENTS ARE FILLED, IF NEEDED - if supply > utilization a Multiple filler approach is used: * If all the ranked utilizations are present these are proportionally incremented * if one is empty, imbalance goes to this commodity * if more than one is empty, Utilization are created based on a ranking of possible Utilization coming from an external source. The approach used id the "Inverse Ranking Rule"

- If supply < utilization * All utilization are reduced by 30 * if this is not enought to cover the imbalance, production is incremented if is not official, if is official, utilization are firs reduced of another 30

If OFFICIAL PRODUCTION is CHANGED, changed rows go in an external file

Trade is never touched

1. PRODUCTION OF DERIVERD Production of derived commodities is created, when is not estimated via the sub-module of derived and when utilization are higher than supplies.

2. FOOD PROCESSING with all productions, food processing is created for all parent commoditeis

3. ALL OTHER ELEMENTS ARE FILLED, IF NEEDED - if supply > utilization a Multiple filler approach is used: * If all the ranked utilizations are present these are proportionally incremented * if one is empty, imbalance goes to this commodity * if more than one is empty, Utilization are created based on a ranking of possible Utilization coming from an external source. The approach used id the "Inverse Ranking Rule"

- If supply < utilization * All utilization are reduced by 30 * if this is not enought to cover the imbalance, production is incremented if is not official, if is official, utilization are firs reduced of another 30

If OFFICIAL PRODUCTION is CHANGED, changed rows go in an external file

Trade is never touched

Value

the Value column of the passed data.table is updated

the Value column of the passed data.table is updated


SWS-Methodology/faoswsStandardization documentation built on Feb. 7, 2022, 5:05 a.m.