Skip to content

LIS-Cross-National-Data-Center/nationalaccountslis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nationalaccountslis

Build & Testing Status

codecov

Overview

nationalaccountslis is an R package to compute national accounts coverage ratios with the LIS Data Center methodology.

It allows users to:

  • Reproduce the coverage ratios published in the LIS Compare.IT dashboard.
  • Download, clean and prepare national accounts data from the OECD.
  • Compute estimates from microdata.
  • Compute and plot coverage ratios.

Installation

You can install the package from this GitHub repo with:

devtools::install_github("https://github.com/JosepER/nationalaccountslis")

Version

This package is currently in Alpha version.

Usage

library(nationalaccountslis)

# download the national accounts using the OECD API
na_data <- download_na_oecd(start_year = 1985, countries = c("ITA", "USA"),
                 items = lis_dashboard_items)

# clean the downloaded national accounts data and create a wide table
na_table <- produce_oecd_na_table(na_data, nationalaccountslis::lis_dashboard_na_formulas)

# compute the estimates from microdata
microdata_estimates <- nationalaccountslis::compute_estimates_lis_microdata(datasets = c("it14i", "us16i"),
                                data_path = "data-raw/", # <- Replace with the path to local files.
                                weights= "hpopwgt",
                                formulas= nationalaccountslis::lis_dashboard_microdata_formulas)

# Compute the coverage ratios 
compute_coverage_ratios(microdata_estimates, na_table)

#  A tibble: 12 × 5
#    ccyyd variable            value_mi  value_na   ratio
#    <chr> <chr>                  <dbl>     <dbl>   <dbl>
#  1 it14i D11R                  47860.   469553. 0.102
#  2 it14i B3GR+D41R+D42R+D45R   25369.   389314. 0.0652
#  3 it14i D62R                  30229.   354996. 0.0852
#  4 it14i D5P+D61P-D12R         27571.   271452. 0.102
#  5 it14i D61P-D12R                 0     72524  0
#  6 it14i B6GR-K1R              75886.  1011206. 0.0750
#  7 us16i D11R                 109355.  8091239. 0.0135
#  8 us16i B3GR+D41R+D42R+D45R   15290.  4482413. 0.00341
#  9 us16i D62R                  18847.  4011206. 0.00470
# 10 us16i D5P+D61P-D12R         34287.  2616116. 0.0131
# 11 us16i D61P-D12R              8485.   657891. 0.0129
# 12 us16i B6GR-K1R             109204. 13431200. 0.00813

About

Functions to compute national accounts coverage ratios with the LIS Data Center methodology

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages