docs pages-build-deployment test_coverage codecov build

Introduction

Back to Contents

The package

MEDUSA is an R package that allows the development of distributional analyses in isolation or in connection with other models (soft links). The extensive database in which the microsimulation model is based allows for highly disaggregated results, taking into account numerous socioeconomic and demographic characteristics of households, such as income level, place of residence, type of family or the feminization degree of the household.

Note: At the moment, medusa package works for Spain, but in the short term the idea is to extend it to all EU countries. Moreover, the package could be extended to all countries that are able to provide the raw data of the model.

The microsimulation model

MEDUSA allows to develop distributional analyses based in an overnight effect microsimulation model. The model is built up with the microdata from the Household Budget Survey. For more details on the model in which medusa is based click here.

Installation Guide

Back to Contents

To use medusa package first you need to follow this steps:

  1. Install R and Rstudio (only if not already installed)

    • To download R click here

    • To download Rstudio click here

  2. Load medusa package. For this, open Rstudio and load the library:

    install.packages('remotes')
    remotes::install_github("bc3LC/medusa")
    library(medusa)


    Now the package is fully loaded and you can start using its functions.

Getting Started

Back to Contents

The medusa package contains 3 main blocks of functions:

  1. To calculate distributional impacts:
    • Main function: calc_di, ex_shocks, available_var_impact , available_var_intersec and ex_var_intersec.
    • Auxiliary functions: load_rawhbs, rename_values, standardize, add_coicop, elevate_hbs, price_shock, impact, impact_intersectional, basic_graph, intersectional_graph, order_var, adjust_wh and adjust_wh_is.
  2. To calculate energy poverty indicators (coming soon)
    • Main function: calc_ep
    • Auxiliary functions: ...
  3. To calculate transport poverty indicators (coming soon)
    • Main function: calc_tp
    • Auxiliary functions: ...

In addition, the package includes some default input files (.Rda), that are read by the different functions.