-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Re-organize model matrices in model$Matrices
- Loading branch information
Showing
1 changed file
with
13 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,14 @@ constructEEIOMatrices <- function(model) { | |
} | ||
# Generate matrices | ||
model$C_m <- generateCommodityMixMatrix(model) # normalized t(Make) | ||
model$V <- as.matrix(model$MakeTransactions) # Make | ||
model$V_n <- generateMarketSharesfromMake(model) # normalized Make | ||
model$U <- as.matrix(dplyr::bind_rows(cbind(model$UseTransactions, | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
MoLi7
Author
Collaborator
|
||
model$FinalDemand), | ||
model$UseValueAdded)) # Use | ||
model$U_d <- as.matrix(dplyr::bind_rows(cbind(model$DomesticUseTransactions, | ||
model$DomesticFinalDemand), | ||
model$UseValueAdded)) # DomesticUse | ||
model$U_n <- generateDirectRequirementsfromUse(model, domestic = FALSE) #normalized Use | ||
model$U_d_n <- generateDirectRequirementsfromUse(model, domestic = TRUE) #normalized DomesticUse | ||
model$W <- as.matrix(model$UseValueAdded) | ||
|
@@ -90,6 +97,12 @@ constructEEIOMatrices <- function(model) { | |
logging::loginfo("Calculating Phi matrix (producer over purchaser price ratio)...") | ||
model$Phi <- calculateProducerbyPurchaserPriceRatio(model) | ||
|
||
# Re-organize matrices in model$Matrices | ||
model$Matrices | ||
matrices <- c("V", "U", "U_d", "A", "A_d", "B", "C", "D", "L", "L_d", "M", "M_d", "N", "N_d", "Rho", "Phi") | ||
model$Matrices <- model[matrices] | ||
model[matrices] <- NULL | ||
|
||
logging::loginfo("Model build complete.") | ||
return(model) | ||
} | ||
|
@MoLi7 Did you ever check the rownames of U after using deplyr here to build it? The rownames are NULL. I discovered this only because the validation is breaking where it tries to index model$U by rowname.