https://github.com/fipelle/cemicrodata.jl
Pull data from the Consumer Expenditure (CE) Public Use Microdata (PUMD) into Julia
https://github.com/fipelle/cemicrodata.jl
bls cex consumer-expenditure julia public-use-microdata pumd
Last synced: 16 days ago
JSON representation
Pull data from the Consumer Expenditure (CE) Public Use Microdata (PUMD) into Julia
- Host: GitHub
- URL: https://github.com/fipelle/cemicrodata.jl
- Owner: fipelle
- License: bsd-3-clause
- Created: 2021-12-04T20:24:22.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-06-23T01:02:07.000Z (about 2 years ago)
- Last Synced: 2025-02-23T04:46:41.333Z (over 1 year ago)
- Topics: bls, cex, consumer-expenditure, julia, public-use-microdata, pumd
- Language: Julia
- Homepage:
- Size: 86.9 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CeMicrodata.jl
```CeMicrodata.jl``` pulls data from the Consumer Expenditure (CE) Public Use Microdata (PUMD) into Julia.
## Installation
The package can be installed with the Julia package manager.
From the Julia REPL, type `]` to enter the Pkg REPL mode and run:
```
pkg> add CeMicrodata
```
Or, equivalently, via the `Pkg` API:
```julia
julia> import Pkg; Pkg.add("CeMicrodata")
```
Note: the package depends on ```unzip``` which needs to be manually installed and available from the terminal.
## Example
```julia
# Collect income data
using CeMicrodata, CSV, Dates, DataFrames, PlotlyJS, Statistics;
prefixes=["itbi", "mtbi", "fmli"];
output = get_data(prefixes, true, 1990, 2020);
hh_output = get_hh_level(output[1], is_itbi=true, UCC_selection=["900000"], quarterly_aggregation=false);
# Aggregate data
hh_output_aggregate = combine(groupby(hh_output, [:REF_DATE]), :HH_DATA=>mean);
PlotlyJS.plot(
hh_output_aggregate,
x=:REF_DATE,
y=:HH_DATA_mean,
)
# Plotting
hh_output_plot = copy(hh_output);
hh_output_plot[!,:REF_YEAR] = lastdayofyear.(hh_output_plot[!,:REF_DATE]);
hh_output_plot = combine(groupby(hh_output_plot, [:CUSTOM_CUID, :REF_YEAR]), :HH_DATA=>sum);
PlotlyJS.plot(
hh_output_plot,
x=:REF_YEAR,
y=:HH_DATA_sum,
kind="violin",
meanline_visible=true,
side="positive",
points=false
)
```