Skip to content

Commit

Permalink
remove margins tables for two region models #290
Browse files Browse the repository at this point in the history
  • Loading branch information
bl-young committed May 16, 2024
1 parent 2e3eb24 commit 9a4cde0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 3 additions & 0 deletions R/CalculationFunctions.R
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,9 @@ calculateSectorPurchasedbySectorSourcedImpact <- function (y, model, indicator)
#' @return A list with M_margin and N_margin
#' @export
calculateMarginSectorImpacts <- function(model) {
if (model$specs$IODataSource == "stateior") {
stop("Margins not available for two-region models")
}
# Calculation fractions of producer price for each margin
MarginCoefficients <- as.matrix(model$Margins[, c("Transportation", "Wholesale", "Retail")]/model$Margins[, c("ProducersValue")])
rownames(MarginCoefficients) <- model$Margins$SectorCode
Expand Down
6 changes: 4 additions & 2 deletions R/LoadIOTables.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ loadIOData <- function(model, configpaths = NULL) {
names(model$InternationalTradeAdjustment) <- model$Industries$Code_Loc
}

# Add Margins table
model$Margins <- getMarginsTable(model)
if (model$specs$IODataSource != "stateior") {
# Add Margins table, currently only for one-region models (see Issue #290)
model$Margins <- getMarginsTable(model)
}

# Add TaxLessSubsidies table
model$TaxLessSubsidies <- generateTaxLessSubsidiesTable(model)
Expand Down

0 comments on commit 9a4cde0

Please sign in to comment.