Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

cepumd R package for computing CE expenditure estimated means

License

NotificationsYou must be signed in to change notification settings

arcenis-r/cepumd

Codecov test coverage

CRAN status

cepumdcepumd website

The purpose of cepumd is to make working with Consumer ExpenditureSurveys (CE) Public-Use Microdata (PUMD) easier toward calculating mean,weighted, annual expenditures (henceforth “mean expenditures”). Thechallenges cepumd seeks to address deal primarily with pulling togetherthe necessary data toward this end. Some of the overarching ideasunderlying the package are as follows:

  • Use a Tidyverse framework for most operations and be (hopefully)generally Tidyverse friendly

  • Balance the effort to make the end user’s experience with CE PUMDeasier while being flexible enough to allow that user to perform anyanalysis with the data they wish

  • Only designed to help users calculate mean expenditures on and of theconsumer unit (CU), i.e., not income, not assets, not liabilities, notgifts.

Challenges addressed bycepumd

cepumd seeks to address challenges in three categories: datagathering/organization; managing data inconsistencies; and calculatingweighted, annual metrics.

  • Data gathering/organization
    • Convert hierarchical grouping (HG) files to data tables usingce_hg()
    • Help the user identify the Universal Classification Codes (UCCs)related to their analysis using a combination ofce_hg() andce_uccs()
    • Combine all required files and variables usingce_prepdata()
  • Managing data inconsistencies
    • Provide the ability to recode variable categories using the CEDictionary for Interview and Diary Surveys
    • Resolve some inconsistencies such as differences code definitionsbetween the Interview and Diary (check the definitions of the“FAM_TYPE” variable categories in 2015 for an example)
    • Provide useful errors or warnings when there are multiple categoriesof something the user is trying to access, e.g., some titles in thehierarchical grouping files (“stub” or “HG” files) repeat andrequires more careful selection of UCCs
  • Calculating weighted, annual metrics
    • Calculate a mean expenditure withce_mean() or expenditurequantile withce_quantile()
    • Account for the factor (annual vs. quarterly expenditure)
    • Account for the “months in scope” of a given consumer unit (CU)
    • Annualize expenditures for either Diary or Interview expenditures
    • Integrate Interview and Diary data as necessary

Installation

Install the production version withinstall.packages("cepumd")

You can install the development version ofcepumd fromGitHub, but you’ll first need thedevtoolspackage:

if (!"devtools"%in% installed.packages()[,"Package"]) {  install.packages("devtools",dependencies=TRUE)}devtools::install_github("arcenis-r/cepumd")

Key cepumd functions

  • The workhorse ofcepumd isce_prepdata(). It merges the householdcharacteristics file (FMLI/-D) with the corresponding expendituretabulation file (MTBI/EXPD) for a specified year, adjusts weights formonths-in-scope and the number of collection quarters, adjusts somecost values by their periodicity factor (some cost categories arerepresented as annual figures and others as quarterly). With therecent update it only requires the first 3 arguments to function: theyear, the survey type, and one or more valid UCCs.ce_prepdata() nowcreates all of the other necessary objects within the function if notprovided.

  • There are two functions for wrangling hierarchical grouping data intomore usable formats:

    • ce_hg() pulls the requested type of HG file (Interview, Diary, orIntegrated) for a specified year.
    • ce_uccs() filters the HG file for the specified expenditurecategory and returns either a data frame with only that section ofthe HG file or the Universal Classification Codes (UCCs) that makeup that expenditure category.
  • There are two functions that the user can use to calculate CE summarystatistics:

    • ce_mean() calculates a mean expenditure, standard error of themean, coefficient of variation, and an aggregate expenditure.
    • ce_quantiles() calculates weighted expenditure quantiles. It isimportant to note that calculating medians for integratedexpenditures is not recommended because the calculation involvesusing weights from both the Diary and Survey instruments.

About

cepumd R package for computing CE expenditure estimated means

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2026 Movatter.jp