calc_di
Go to the defined folder in your directory and open the csv “Example_shocks”.
Define the scenarios: Each column Scenario__ is a scenario. To
run calc_di
for a single scenario delete column Scenario2.
To add another scenario, copy column Scenario2 to the right and change
the heading to Scenario3. You can also rename the scenarios by changing
the heading of each column (e.g. renaming “Scenario1” to “Shock1”). It
is recommended to keep the names short, as additional variables with
this name will be created later and inserted into the graphs.
Enter the price shocks: Each row corresponds to a COICOP code [1] . Enter in each row the price change to be applied to each coicop in each scenario (column). A price shock greater than 1 indicates a price increase (e.g. 1.1 indicates a 10% increase) and less than 1 indicates a price decrease (e.g. 0.9 indicates a 10% decrease). If there is no shock in that category, keep 1.
Save the edited csv file.
Upload the edited file to R by running the following function in the terminal:
file_name <- read.csv(file, # File name or full file path
header = TRUE, # Read the header (TRUE)
sep = ",", # Value separator
dec = ".", # Decimal point
...) # Additional arguments
calc_di
that this is the file from which to
take the price shocks to be applied.
calc_di( year,
elevate = F,
shocks = file_name, # Indicate here your file name
...)
[1] The COICOP variables of the file correspond to the aggregate variables of the package, if you are not going to aggregate the COICOP variables you have to replace the column labels by the COICOP variables that appear in your dataset.
calc_di
to calculate distributional impacts
Select one of the variables that the function returns in the console. For example, “ZONA”.
Enter that variable in the var_impact
argument of
calc_di
. By default, var_impact = "all"
,
i.e. it calculates the distributional impacts for all variables returned
by available_var_impact()
. For more information on
variables click here.
calc_di( year,
elevate = F,
shocks ,
var_impact = "ZONA", # Indicate here the selected variable
...)
var_impact
argument of
calc_di
.
file_name <- read.csv(file, # File name or full file path
header = TRUE,
...) # Additional arguments
var_intersec
argument in
calc_di
. By default, var_intersec = NULL
,
i.e. iif no data is entered in this argument it will not calculate any
intersectional impacts, it will only calculate distributional impacts
for individual variables. For more information on variables click here.
calc_di( year,
elevate = F,
shocks ,
var_intersec = file_name, # Indicate here the file name of the selected set of variables
...)