balanceResidual: Balance Residual

Description Usage Arguments Details Value

View source: R/balanceResidual.R

Description

This function forces a balance in the passed elements by allocating the imbalance to one element.

Usage

1
2
3
4
balanceResidual(data, standParams, feedCommodities = c(), tree = tree,
  indCommodities = c(), primaryCommodities = c(), stockCommodities = c(),
  seedCommodities = c(), lossCommodities = c(), foodCommodities = c(),
  foodProcessCommodities = c(), imbalanceThreshold = 10, cut = c())

Arguments

data

The data.table containing the full dataset for standardization.

standParams

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.

feedCommodities

Sometimes excess supply will need to be allocated to some processed product. The default is to place it into food, but this list specifies which elements should allocate such a difference to feed.

tree

this is the sub tree used in the function.

indCommodities

Same as feedCommodities, but for commodities where we allocate the difference to industrial utilization.

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 which commodities should allocate imbalance to stock

seedCommodities

This list specify which commodities should allocate imbalance to seed.

lossCommodities

This list specify which commodities should allocate imbalance to loss.

foodCommodities

if we use the foodCommodities from the Crude Balancing matrix old faostat.

foodProcessCommodities

Same as feedCommodities, but for commodities where we allocate the difference to food processing.

imbalanceThreshold

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

cut

these are primary equivalent commodities.

Details

If supply < utilization, the imbalance is always assigned to production (as trade is generally assumed to be fixed and stock changes are usually 0 and hence also fixed).

If supply > utilization, we must choose where to allocate the imbalance. The default variable is food, but for some commodities we could instead use feed, food processing, or industrial.

Value

Nothing is returned, but the Value column of the passed data.table is updated.


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