Skip to content
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

Provide function to access employment counts #43

Open
brandones opened this issue Dec 10, 2024 · 4 comments
Open

Provide function to access employment counts #43

brandones opened this issue Dec 10, 2024 · 4 comments

Comments

@brandones
Copy link

Calculating employment multipliers requires access to per-industry employment averages. Right now stateior does not, as far as I know, provide any way to access that information, despite the fact that that information is used in producing the IO tables. Sectoral employment from elsewhere (e.g. QCEW) generally does not align with the BEA Summary IO 2012 Schema. I am able to get the necessary information using the following code, mostly cribbed from getStateEmploymentbyBEASummary:

readCSV <- function(filename, fill = FALSE) {
  df <- utils::read.table(filename, sep = ",", header = TRUE,
                          stringsAsFactors = FALSE, check.names = FALSE,
                          fill = fill, fileEncoding = "UTF-8-BOM")
  return(df)
}

loadBEAStateDatatoBEASummaryMapping <- function(dataname) {
  filename <- paste0("Crosswalk_State", dataname, "toBEASummaryIO2012Schema.csv")
  mapping <- readCSV(system.file("extdata", filename, package = "stateior"))
  return(mapping)
}

getStateEmploymentTable <- function(year) {
  BEAStateEmp <- loadStateIODataFile(paste0("State_Employment_", year))
  loadBEAStateDatatoBEASummaryMapping("Employment")
  EmptoBEAmapping <- loadBEAStateDatatoBEASummaryMapping("Employment")
  BEAStateEmp <- merge(BEAStateEmp[, c("GeoName", "LineCode", as.character(year))],
                        EmptoBEAmapping, by = "LineCode")
  BEAStateEmp <- stats::aggregate(BEAStateEmp[, as.character(year)],
                                  by = list(BEAStateEmp$BEA_2012_Summary_Code,
                                            BEAStateEmp$GeoName), sum)
  colnames(BEAStateEmp) <- c("BEA_2012_Summary_Code", "State", "Emp")
  return(BEAStateEmp)
}

getStateEmploymentTable(2019)

stateior should simply export a function like getStateEmploymentTable to make employment data accessible.

ASIDE: Why not do the same for the Leontief matrices?

@WesIngwersen
Copy link
Collaborator

We have this type of functionality in the model building package useeior. We're using useeior to build state-level two region environmentally-extended input-output models and calculate equivalents to multipliers, including for employment. The environmental extensions are totally optional. Here is an example model output for Colorado with link that include the description of the code that was used. Due to resource constraints and a small team maintaining all of our Tools for Industrial Ecology Modeling of which this package is a part of, we don't plan to add that kind of equivalent functionality into stateior at this time. thanks for your interest!

@brandones
Copy link
Author

I see. That looks a lot more complicated to use. Would you consider PRs to add this kind of functionality to stateior, if I were to open them? I think it would be pretty simple; mostly just exposing to the user what is already available internally.

@WesIngwersen
Copy link
Collaborator

I see. That looks a lot more complicated to use. Would you consider PRs to add this kind of functionality to stateior, if I were to open them? I think it would be pretty simple; mostly just exposing to the user what is already available internally.

Sure, exporting more functions or wrapping them with some simple functionality is fine. Thanks for your offer, i look forward to reviewing the PR.

@brandones
Copy link
Author

Opened #44

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants