8000 Fix Rho calculation by MoLi7 · Pull Request #177 · USEPA/useeior · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Fix Rho calculation #177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions R/AdjustPrice.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ adjustResultMatrixPrice <- function(matrix_name, currency_year, purchaser_price=
return(mat)
}

#' Calculate year by model IO year price ratio.
#' Calculate model IO year by year price ratio.
#' @param model A complete EEIO model: a list with USEEIO model components and attributes.
#' @return A dataframe of year by model IO year price ratio.
calculateYearbyModelIOYearPriceRatio <- function(model) {
#' @return A dataframe of model IO year by year price ratio.
calculateModelIOYearbyYearPriceRatio <- function(model) {
CPI_df <- model[[paste0("MultiYear", model$specs$CommodityorIndustryType, "CPI")]]
CPI_ratio_matrix <- as.matrix(CPI_df/CPI_df[, as.character(model$specs$IOYear)])
CPI_ratio_matrix <- as.matrix(CPI_df[, as.character(model$specs$IOYear)]/CPI_df)
return(CPI_ratio_matrix)
}

Expand Down
2 changes: 1 addition & 1 deletion R/BuildModel.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ constructEEIOMatrices <- function(model) {

# Calculate year over model IO year price ratio
logging::loginfo("Calculating Rho matrix (price year ratio)...")
model$Rho <- calculateYearbyModelIOYearPriceRatio(model)
model$Rho <- calculateModelIOYearbyYearPriceRatio(model)

# Calculate producer over purchaser price ratio.
logging::loginfo("Calculating Phi matrix (producer over purchaser price ratio)...")
Expand Down
17 changes: 17 additions & 0 deletions man/calculateModelIOYearbyYearPriceRatio.Rd

Some generated files are not rendered by default. Learn more 69F8 about how customized files appear on GitHub.

17 changes: 0 additions & 17 deletions man/calculateYearbyModelIOYearPriceRatio.Rd

This file was deleted.

0