Title: | MADRaT based package on factor inputs |
---|---|
Description: | This package provides functions for MAgPIE input data on factor inputs to agricultural production (with a focus on capital and labor). |
Authors: | Debbora Leip [aut, cre], Edna Molina Bacca [aut] |
Maintainer: | Debbora Leip <[email protected]> |
License: | LGPL-3 | file LICENSE |
Version: | 0.7.2 |
Built: | 2024-11-07 15:17:41 UTC |
Source: | https://github.com/pik-piam/mrfactors |
This package provides functions for MAgPIE input data on factor inputs to agricultural production (with a focus on capital and labor).
Maintainer: Debbora Leip <[email protected]>
Useful links:
calculates complete dataset of number of people employed in agriculture, forestry and fishery based on ILO modelles dataset and GDPpcPPP05 for regression
calcAgEmplILO( subsectors = TRUE, inclFish = FALSE, inclForest = FALSE, dataVersionILO = "Aug24" )
calcAgEmplILO( subsectors = TRUE, inclFish = FALSE, inclForest = FALSE, dataVersionILO = "Aug24" )
subsectors |
boolean: should overall values be split into the sub-sectors agriculture, forestry and fishery based on their relative share of people employed, and agriculture further split into crops and livestock based on VoP |
inclFish |
boolean: should employment in fisheries be included? |
inclForest |
boolean: should emplyoment in forestry be included? |
dataVersionILO |
which version of the ILO input data to use. "" for the oldest version and old regression, or "monthYear" (e.g. "Aug24") for newer data |
List of magpie objects with results on country level, weight on country level, unit and description.
Debbora Leip
## Not run: calcOutput("AgEmplILO") ## End(Not run)
## Not run: calcOutput("AgEmplILO") ## End(Not run)
This function calculates factor requirement costs (constant 2017 US$MER/tDM) on regional level, based FAO databases
calcFacReq(splitSectors = FALSE)
calcFacReq(splitSectors = FALSE)
splitSectors |
if TRUE requirements for labor and capital will be reported separately |
MAgPIE object
Debbora Leip
[calcOutput()],[calcFactorIntensity()]
## Not run: calcOutput("calcFacReq") ## End(Not run)
## Not run: calcOutput("calcFacReq") ## End(Not run)
This function calculates 2005 global factor requirement costs (05USDMER/tDM) using FAO databases
calcFacReqGLO()
calcFacReqGLO()
MAgPIE object
Edna J. Molina Bacca
[calcOutput()],[calcFactorIntensity()]
## Not run: calcOutput("calcFacReqGLO") ## End(Not run)
## Not run: calcOutput("calcFacReqGLO") ## End(Not run)
combines factor costs for crop and livestock production in mio. US$MER05
calcFactorCosts( datasource = "USDA", otherLivst = FALSE, subsectors = FALSE, unit = "constant 2017 US$MER" )
calcFactorCosts( datasource = "USDA", otherLivst = FALSE, subsectors = FALSE, unit = "constant 2017 US$MER" )
datasource |
only source available is "USDA" (calculates factor costs by applying factor cost share from USDA to VoP from FAO) |
otherLivst |
boolean: should FAO livestock categories that can't be matched to MAgPIE categories (i.e. beeswax, wool, silkworms, and honey) be reported as "livst_other"? |
subsectors |
boolean: should output be aggregated or reported by crop and livestock subsectors? |
unit |
output currency unit based on the toolConvertGDP function from the GDPuc library |
List of magpie objects with results on country level, weight on country level, unit and description.
Debbora Leip
## Not run: calcOutput("FactorCosts") ## End(Not run)
## Not run: calcOutput("FactorCosts") ## End(Not run)
calculates factor costs for crop production in mio. US$MER05
calcFactorCostsCrops(datasource = "USDA", unit = "constant 2017 US$MER")
calcFactorCostsCrops(datasource = "USDA", unit = "constant 2017 US$MER")
datasource |
only source available is "USDA" (calculates factor costs by applying factor cost share from USDA to VoP from FAO) |
unit |
output currency unit based on the toolConvertGDP function from the GDPuc library |
List of magpie objects with results on country level, weight on country level, unit and description.
Debbora Leip
## Not run: calcOutput("FactorCostsCrops") ## End(Not run)
## Not run: calcOutput("FactorCostsCrops") ## End(Not run)
calculates factor costs for livestock production in mio. US$MER05
calcFactorCostsLivst( datasource = "USDA", otherLivst = FALSE, inclFish = FALSE, unit = "constant 2017 US$MER" )
calcFactorCostsLivst( datasource = "USDA", otherLivst = FALSE, inclFish = FALSE, unit = "constant 2017 US$MER" )
datasource |
only source available is "USDA" (calculates factor costs by applying factor cost share from USDA to VoP from FAO) |
otherLivst |
boolean: should FAO livestock categories that can't be matched to MAgPIE categories (i.e. beeswax, wool, silkworms, and honey) be reported as "livst_other"? |
inclFish |
boolean: should fish factor costs be included? |
unit |
output currency unit based on the toolConvertGDP function from the GDPuc library |
List of magpie objects with results on country level, weight on country level, unit and description.
Debbora Leip
## Not run: calcOutput("FactorCostsLivst") ## End(Not run)
## Not run: calcOutput("FactorCostsLivst") ## End(Not run)
Calculates factor intensity in crop production for labour and/or capital from USDA (Inputs share) and FAO (Value of Production)in constant 2017 US$MER per ton. Capital intensity and requirements can also be calculated from FAO's CapitalStock database.
calcFactorIntensity( output = "intensities", method = "USDA", unit = "constant 2017 US$MER" )
calcFactorIntensity( output = "intensities", method = "USDA", unit = "constant 2017 US$MER" )
output |
needed outputs. It can be either "intensities" (Capital/Labour factor intensities), "requirements" (Capital Stock requirements per ton), and "CapitalShare" for "USDA" method. For the "CapitalStock" method only "intensities" and "requirements" outputs supported. |
method |
"USDA" or "CapitalStock" |
unit |
output currency unit based on the toolConvertGDP function from the GDPuc library |
magpie object of the factor requirements intensity or factor intensity in USD/tDM per crop, or capital share fraction.
Edna J. Molina Bacca
[calcOutput()]
## Not run: a <- calcOutput("FactorIntensity") ## End(Not run)
## Not run: a <- calcOutput("FactorIntensity") ## End(Not run)
Calculates the factor factor shares for crop or livestock production from USDA'S Inputs shares.
calcFractionInputsUSDA( products = "kcr", keepConstantExtrapolation = TRUE, interpolate = TRUE )
calcFractionInputsUSDA( products = "kcr", keepConstantExtrapolation = TRUE, interpolate = TRUE )
products |
either "kcr" for crops, or "kli" for livestock |
keepConstantExtrapolation |
boolean: should constant extrapolation from Fuglie et al. be kept? |
interpolate |
boolean: should the data be interpolated to the middle of the decade? |
magpie object of the shares of the factor requirements in agriculture (capital, labor, materials, land).
Edna J. Molina Bacca, Debbora Leip
[calcOutput()]
## Not run: a <- calcOutput("FractionInputsUSDA") ## End(Not run)
## Not run: a <- calcOutput("FractionInputsUSDA") ## End(Not run)
calculates dataset of hourly labor costs per employee in agriculture
calcHourlyLaborCosts( datasource = "USDA_FAO", dataVersionILO = "Aug24", sector = "agriculture", fillWithRegression = TRUE, calibYear = 2010, cutAfterCalibYear = TRUE, projection = FALSE )
calcHourlyLaborCosts( datasource = "USDA_FAO", dataVersionILO = "Aug24", sector = "agriculture", fillWithRegression = TRUE, calibYear = 2010, cutAfterCalibYear = TRUE, projection = FALSE )
datasource |
either raw data from "ILO" (agriculture+forestry+fishery) or data calculated based on total labor costs from "USDA_FAO" (crop+livestock production). |
dataVersionILO |
Which version of ILO data to use (for hourly labor costs if source is ILO, for ag empl. if source is USDA_FAO). "" for the oldest version, or "monthYear" (e.g. "Aug24") for a newer version) |
sector |
should average hourly labor costs be reported ("agriculture"), or hourly labor costs specific to either "crops" or "livestock" production. For ILO only the aggregate hourly labor costs are available. |
fillWithRegression |
boolean: should missing values be filled based on a regression between ILO hourly labor costs and GDPpcMER (calibrated to countries) |
calibYear |
in case of fillWithRegression being TRUE, data after this year will be ignored and calculated using the regression (calibrated for each year to calibYear, or the most recent year with data before calibYear). NULL if all data should be used for calibration |
cutAfterCalibYear |
boolean, only relevant if fillWithRegression is TRUE. If cutAfterCalibYear is TRUE, raw data after the calib year is overwritten by regression results (necessary for consistency with calculation within MAgPIE). If FALSE, raw data is kept and only gaps are filled with regression |
projection |
either FALSE or SSP on which projections should be based. Only relevant if fillWithRegression is TRUE. |
List of magpie objects with results on country level, weight on country level, unit and description.
Debbora Leip
## Not run: calcOutput("HourlyLaborCosts") ## End(Not run)
## Not run: calcOutput("HourlyLaborCosts") ## End(Not run)
Adds non-allocated subsidies to crop subsidies (as most subsidies are linked to land area), and excludes NRP subsidies (as those are border measures, which are already reflected in ag. prices)
calcIFPRIsubsidy(fillGaps = TRUE)
calcIFPRIsubsidy(fillGaps = TRUE)
fillGaps |
boolean, should gaps in the dataset be filled using interpolation? |
magpie object. in mio. USD
Debbora Leip
[calcOutput()]
## Not run: a <- calcOutput("IFPRIsubsidy") ## End(Not run)
## Not run: a <- calcOutput("IFPRIsubsidy") ## End(Not run)
calculates total labor costs in mio. US$MER05 (coverage depends on source: crop, livestock and fish production for USDA, and additionally forestry for GTAP and ILO)
calcLaborCosts( datasource = "ILO", dataVersionILO = "Aug24", subsectors = TRUE, inclFish = FALSE, inclForest = FALSE, otherLivst = TRUE, gtapVar = "NVFA", addSubsidies = FALSE )
calcLaborCosts( datasource = "ILO", dataVersionILO = "Aug24", subsectors = TRUE, inclFish = FALSE, inclForest = FALSE, otherLivst = TRUE, gtapVar = "NVFA", addSubsidies = FALSE )
datasource |
data source on which the labor costs should be based. Available are ILO, USDA (which also uses data on VoP from FAO), and GTAP. |
dataVersionILO |
If source is ILO, the version can be chosen. "" for the oldest version, or "monthYear" (e.g. "Aug24") for a newer version) |
subsectors |
boolean: should output be aggregated or split into available subsectors (crops, livst, forestry, fishery) |
inclFish |
boolean: should fish labor costs be included? |
inclForest |
boolean: should forestry labor costs be included (only available for ILO and GTAP)? |
otherLivst |
boolean: should other_livst category (i.e. beeswax, wool, silkworms, and honey) be included in livestock (only relevant for datasource USDA)? |
gtapVar |
variable name to use from GTAP (only relevant if source is "GTAP") |
addSubsidies |
boolean: should subsidy data (from IFPRI) should be added to VoP before applying USDA cost shares (only relevant if datasource is "USDA") |
List of magpie objects with results on country level, weight on country level, unit and description.
Debbora Leip
## Not run: calcOutput("LaborCosts", datasource = "ILO") ## End(Not run)
## Not run: calcOutput("LaborCosts", datasource = "ILO") ## End(Not run)
Calculates factor costs that should affect agricultural employment but are not included in MAgPIE factor costs
calcNonMAgPIEFactorCosts( subtype = "subsidies", aggSubsidies = FALSE, extrapolate = TRUE )
calcNonMAgPIEFactorCosts( subtype = "subsidies", aggSubsidies = FALSE, extrapolate = TRUE )
subtype |
either factor cost share of "subsidies" (which don't enter MAgPIE labor costs as they should not affect prices), or of "missingVoP" (which refers to livestock VoP that can't be mapped to MAgPIE livestock categories, i.e. wool, beeswax, honey, silk-worms) |
aggSubsidies |
boolean: if subtype is "subsidies", should crop and livestock subsidies be reported separately or as aggregate? |
extrapolate |
boolean: should values be extrapolate (by keeping constant) until 2150? |
magpie object. in mio. USD
Debbora Leip
[calcOutput()]
## Not run: a <- calcOutput("NonMAgPIEFactorCosts", subtype = "subsidies") ## End(Not run)
## Not run: a <- calcOutput("NonMAgPIEFactorCosts", subtype = "subsidies") ## End(Not run)
producer prices for agricultural products. 05USDMER/tDM prices from FAO, no currency conversion
calcPricesProducer( products = "kcr", calculation = "VoP", weighting = "production" )
calcPricesProducer( products = "kcr", calculation = "VoP", weighting = "production" )
products |
either "kcr" or "kcl" |
calculation |
type of calculation "FAO" (directly reads the data), "VoP" calculates as VoP/Production, only "FAO" available for "kli" products. |
weighting |
either "production" (default) or "consumption" based weighting |
magpie object. prices in year specific annual
Edna J. Molina Bacca
[calcOutput()]
## Not run: a <- calcOutput("PricesProducer") ## End(Not run)
## Not run: a <- calcOutput("PricesProducer") ## End(Not run)
calculates agricultural production costs (split into different cost categories)
calcProductionCosts(datasource = "Vittis", unit = "constant 2017 US$MER")
calcProductionCosts(datasource = "Vittis", unit = "constant 2017 US$MER")
datasource |
Datasource of production costs, currently only "Vittis" |
unit |
output currency unit based on the toolConvertGDP function from the GDPuc library |
List of magpie objects with results on country level, weight on country level, unit and description.
Debbora Leip
## Not run: calcOutput("ProductionCosts", source = "Vittis") ## End(Not run)
## Not run: calcOutput("ProductionCosts", source = "Vittis") ## End(Not run)
Calculates regression coefficients used by calc functions for ILO data sets
calcRegressionsILO( subtype = "AgEmplShare", dataVersionILO = "Aug24", thresholdWage = 0.1, forceWageIntercept = TRUE, wageRegrType = NULL, recalculate = FALSE )
calcRegressionsILO( subtype = "AgEmplShare", dataVersionILO = "Aug24", thresholdWage = 0.1, forceWageIntercept = TRUE, wageRegrType = NULL, recalculate = FALSE )
subtype |
specifies the regression type: "AgEmplShare" for a regression between the square root of the share of people employed in agriculture (out of total population) and the log (base 10) of GDP pc PPP05. "HourlyLaborCosts" for a regression between mean nominal hourly labor cost per employee in agriculture and GDP pc MER05. |
dataVersionILO |
which version of the ILO input data and regression to use. "" for the oldest version and old regression, or "monthYear" (e.g. "Aug24") for newer data with the new regression type |
thresholdWage |
only relevant for linear hourly labor cost regression: for low GDP pc MER, the regression between hourly labor costs and GDP pc MER can lead to unreasonably low or even negative hourly labor costs. Therefore, we set all hourly labor costs below this threshold to the threshold. |
forceWageIntercept |
only relevant for linear hourly labor cost regression: If TRUE, the wage threshold is also used as intercept of the regression. If FALSE, the intercept is determined by the regression |
wageRegrType |
Only relevant for HourlyLaborCosts regression. If NULL, a linear regression will be used for the oldest data (dataVersionILO: ""), and a loglog regression for all newer data. Can be overwritten by specifically setting wageRegrType to "linear" or "loglog". |
recalculate |
whether regression should be read from source folder, or recalculated from scratch. Recalculation can lead to new regression coefficients if data changed, and result should always be checked. |
Debbora Leip
## Not run: a <- calcOutput("RegressionsILO", subtype = "HourlyLaborCosts") ## End(Not run)
## Not run: a <- calcOutput("RegressionsILO", subtype = "HourlyLaborCosts") ## End(Not run)
Calculates the overall value of production of the agriculture, forestry and fisheries sectors. Forestry and Fisheries are calculated from exports values.
calcVoPAFF(unit = "constant 2017 US$MER")
calcVoPAFF(unit = "constant 2017 US$MER")
unit |
output currency unit based on the toolConvertGDP function from the GDPuc library |
magpie object. in mio. USD
Edna J. Molina Bacca, Debbora Leip
[calcOutput()]
## Not run: a <- calcOutput("VoPAFF") ## End(Not run)
## Not run: a <- calcOutput("VoPAFF") ## End(Not run)
Calculates the value of production of individual production items or its fraction compared to overall Value of Production (Agriculture, Fish, Forestry).
calcVoPcrops(fillGaps = TRUE, unit = "constant 2017 US$MER")
calcVoPcrops(fillGaps = TRUE, unit = "constant 2017 US$MER")
fillGaps |
boolean: should gaps be filled using production * prices (where production data is available)? |
unit |
output currency unit based on the toolConvertGDP function from the GDPuc library |
magpie object. in mio. USD or fraction
Edna J. Molina Bacca, Debbora Leip
[calcOutput()]
## Not run: a <- calcOutput("VoPcrops") ## End(Not run)
## Not run: a <- calcOutput("VoPcrops") ## End(Not run)
Calculates the value of production of individual livestock categories
calcVoPlivst(other = FALSE, fillGaps = TRUE, unit = "constant 2017 US$MER")
calcVoPlivst(other = FALSE, fillGaps = TRUE, unit = "constant 2017 US$MER")
other |
boolean: should FAO livestock categories that can't be matched to MAgPIE categories (i.e. beeswax, wool, silkworms, and honey) be reported as "livst_other"? |
fillGaps |
boolean: should gaps be filled using production * prices (where production data is available)? |
unit |
output currency unit based on the toolConvertGDP function from the GDPuc library |
magpie object
Debbora Leip
[calcOutput()]
## Not run: a <- calcOutput("VoPlivst") ## End(Not run)
## Not run: a <- calcOutput("VoPlivst") ## End(Not run)
calculates complete dataset of mean weekly hours worked by people employed in agriculture, forestry and fishery based on ILO dataset
calcWeeklyHoursILO(projections = FALSE, dataVersionILO = "Aug24")
calcWeeklyHoursILO(projections = FALSE, dataVersionILO = "Aug24")
projections |
boolean, should weekly hours be projected (by keeping constant) up to 2150? |
dataVersionILO |
which version of the ILO input data to use. "" for the oldest version and old regression, or "monthYear" (e.g. "Aug24") for newer data |
List of magpie objects with results on country level, weight on country level, unit and description.
Debbora Leip
## Not run: calcOutput("WeeklyHoursILO") ## End(Not run)
## Not run: calcOutput("WeeklyHoursILO") ## End(Not run)
disaggregates EU subsidies for crops and livestock from IFPRI table to country level
convertIFPRIsubsidy(x)
convertIFPRIsubsidy(x)
x |
magpie object provided by the read function |
magpie object of agricultural subsidies
Debbora Leip
## Not run: a <- readSource("IFPRIsubsidy", convert = TRUE) ## End(Not run)
## Not run: a <- readSource("IFPRIsubsidy", convert = TRUE) ## End(Not run)
transforms currencies where applicable, and fills missing countries in ILOSTAT data with 0
convertILOSTAT(x)
convertILOSTAT(x)
x |
unconverted magpie object from read-script |
Data as MAgPIE object with common country list
Debbora Leip
## Not run: a <- readSource("ILOSTAT", subtype = "EmplByActivityModelled", convert = TRUE) ## End(Not run)
## Not run: a <- readSource("ILOSTAT", subtype = "EmplByActivityModelled", convert = TRUE) ## End(Not run)
Aggregate production costs from Vittis dataset to MAgPIE crop categories and change unit from USD PPP 2000 to USD MER 2017.
convertVittis(x)
convertVittis(x)
x |
MAgPIE object to be converted |
A MAgPIE object containing national-scale costs of production for 10 crops, disaggregated in 9 distinct cost elements
Debbora Leip
Remove values that are just constant extrpolation
correctTFPUSDA(x)
correctTFPUSDA(x)
x |
magpie object provided by the read function |
corrected mapie object on national-scale costs of production for 10 crops, disaggregated in 9 distinct cost elements
Debbora Leip
[readTFPUSDA()]
Correct inconsistencies in crop naming in the Vittis dataset
correctVittis(x)
correctVittis(x)
x |
magpie object provided by the read function |
corrected mapie object on national-scale costs of production for 10 crops, disaggregated in 9 distinct cost elements
Debbora Leip
[readVittis()]
Download data from ILOSTAT
downloadILOSTAT(subtype)
downloadILOSTAT(subtype)
subtype |
Type of ILOSTAT data that should be downloaded, version specified by suffic "_MonthYear" (month and year of download) |
metadata entry
Debbora Leip
## Not run: downloadSource("ILOSTAT", "EmplByActivityModelled") ## End(Not run)
## Not run: downloadSource("ILOSTAT", "EmplByActivityModelled") ## End(Not run)
Downloads data of input shares based on a TFP assessment from USDA.
downloadTFPUSDA()
downloadTFPUSDA()
raw TFP file from USDA
Edna J. Molina Bacca
[downloadSource()]
Read in data on hourly labor costs in agriculture for China.
readHourlyLaborCostsChina()
readHourlyLaborCostsChina()
data as MAgPIE object
Debbora Leip
## Not run: readSource("HourlyLaborCostsChina") ## End(Not run)
## Not run: readSource("HourlyLaborCostsChina") ## End(Not run)
read subsidies for crops and livestock (and non-allocated) from IFPRI table
readIFPRIsubsidy()
readIFPRIsubsidy()
magpie object of agricultural subsidies
Debbora Leip
## Not run: readSource("IFPRIsubsidy") ## End(Not run)
## Not run: readSource("IFPRIsubsidy") ## End(Not run)
Read in ILOSTAT data that has been downloaded from the ILOSTAT website
readILOSTAT(subtype)
readILOSTAT(subtype)
subtype |
Type of ILOSTAT data that should be downloaded, version specified by suffic "_MonthYear" (month and year of download)
|
ILOSTAT data as MAgPIE object
Debbora Leip
## Not run: readSource("ILOSTAT", "EmplByActivityModelled") ## End(Not run)
## Not run: readSource("ILOSTAT", "EmplByActivityModelled") ## End(Not run)
Read regression coefficients which are used to fill missing values of ILO datasets
readRegressionsILO(subtype = "AgEmplShare")
readRegressionsILO(subtype = "AgEmplShare")
subtype |
Type of ILOSTAT data for which regression coefficients should be read
The version of regression and underlying data can be chosen by adding a suffix to the subtype, "" for the oldest version, or "_monthYear" (e.g. "_Aug24") for newer version |
regression coefficients as MAgPIE object
Debbora Leip
## Not run: readSource("RegressionsILO", "AgEmpl") ## End(Not run)
## Not run: readSource("RegressionsILO", "AgEmpl") ## End(Not run)
Reads the input shares from USDA's Agricultural total factor productivity growth indices assessment.
readTFPUSDA()
readTFPUSDA()
magpie object with fractions of different input factors in the overall production value
Edna J. Molina Bacca
[readSource()]
Read-in cost data from Vittis dataset.
readVittis()
readVittis()
National-scale costs of production for 10 crops, disaggregated in 9 distinct cost elements
Debbora Leip
[readSource()]
## Not run: a <- readSource("Vittis") ## End(Not run)
## Not run: a <- readSource("Vittis") ## End(Not run)