Title: | Run PACTA on multiple loan books easily |
---|---|
Description: | This repo allows running PACTA analyses on multiple loan books in a structured way and provides access to additional PACTA-related metrics for multiple loan books. Results take the form of csv files and plots and are exported to specified project paths. |
Authors: | Jacob Kastl [aut, cre, ctr] , CJ Yetman [aut, ctr] , Monika Furdyna [aut, ctr] , RMI [cph, fnd] |
Maintainer: | Jacob Kastl <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.0.0.9000 |
Built: | 2024-09-19 15:17:46 UTC |
Source: | https://github.com/rmi-pacta/pacta.multi.loanbook |
ABCD test data
abcd_test_data
abcd_test_data
An object of class tbl_df
(inherits from tbl
, data.frame
) with 582 rows and 13 columns.
An overview of the output data sets generated by the package, their data types, and the definitions of the variables.
data_dictionary
data_dictionary
data_dictionary
Name of the dataset
Name of the column
Data type of the column
Description of what the column stands for
Which values are allowed for the column
...
For more details see the help vignette:
vignette("data_dictionary", package = "pacta.multi.loanbook")
internal
Loan book test data
loanbook_test_data
loanbook_test_data
An object of class tbl_df
(inherits from tbl
, data.frame
) with 20 rows and 19 columns.
plot_aggregate_loanbooks
plot_aggregate_loanbooks(config)
plot_aggregate_loanbooks(config)
config |
either a single string defining the path to a config YML file or a list object that contains the appropriate config params |
NULL
(called for side effects)
Make a sankey plot
plot_sankey( data, group_var, capitalise_node_labels = TRUE, save_png_to = NULL, png_name = "sankey.png", nodes_order_from_data = FALSE ) prep_sankey( data_alignment, region, year, group_var, middle_node, middle_node2 = NULL )
plot_sankey( data, group_var, capitalise_node_labels = TRUE, save_png_to = NULL, png_name = "sankey.png", nodes_order_from_data = FALSE ) prep_sankey( data_alignment, region, year, group_var, middle_node, middle_node2 = NULL )
data |
data.frame. Should have the same format as output of
|
group_var |
Character. Vector of length 1. Variable to group by. |
capitalise_node_labels |
Logical. Flag indicating if node labels should be converted into better looking capitalised form. |
save_png_to |
Character. Path where the output in png format should be saved |
png_name |
Character. File name of the output. |
nodes_order_from_data |
Logical. Flag indicating if nodes order should be determined by an algorithm (in case of big datasets often results in a better looking plot) or should they be ordered based on data. |
data_alignment |
data.frame. Holds aggregated alignment metrics per
company for tms sectors. Must contain columns: |
region |
Character. Region to filter |
year |
Integer. Year on which |
middle_node |
Character. Column specifying the middle nodes to be
plotted in sankey plot. Must be present in |
middle_node2 |
Character. Column specifying the middle nodes to be
plotted in sankey plot. Must be present in |
data.frame
# TODO
# TODO
Plot alignment scatterplot
plot_scatter( data, sector = NULL, scenario_source = NULL, scenario = NULL, year = NULL, region = NULL, title = NULL, subtitle = NULL, alignment_limit = NULL, data_level = c("company", "group_var"), cap_outliers = NULL, floor_outliers = NULL ) prep_scatter( data_bopo, data_net, data_level = c("group_var", "company"), year, sector, region, group_var, groups_to_plot = NULL )
plot_scatter( data, sector = NULL, scenario_source = NULL, scenario = NULL, year = NULL, region = NULL, title = NULL, subtitle = NULL, alignment_limit = NULL, data_level = c("company", "group_var"), cap_outliers = NULL, floor_outliers = NULL ) prep_scatter( data_bopo, data_net, data_level = c("group_var", "company"), year, sector, region, group_var, groups_to_plot = NULL )
data |
data.frame. Should have the same format as output of
|
sector |
Character. Sector to filter data on. |
scenario_source |
Character. Scenario source to be used in the plot caption. |
scenario |
Character. Scenario name to be used in the plot caption. |
year |
Integer. Year on which the data should be filtered. |
region |
Character. Region to filter data on. |
title |
Character. Custom title if different than default. |
subtitle |
Character. Custom subtitle if different than default. |
alignment_limit |
Numeric. Limit to be applied to the x- and y-axis scales and to alignment values for colouring. By default the maximum absolute alignment value of is used. |
data_level |
Character. Level of the plotted data. Can be |
cap_outliers |
Numeric. Cap which should be applied to the alignment values in the data. Values bigger than cap are plotted on the border of the plot. |
floor_outliers |
Numeric. Floor which should be applied to the alignment values in the data. Values smaller than floor are plotted on the border of the plot. |
data_bopo |
data.frame. Data containing buildout and phaseout alignment
values. Must contain columns: |
data_net |
data.frame. Data containing net alignment values. Must
contain columns: |
group_var |
Character. Vector of length 1. Variable to group by. |
groups_to_plot |
Character vector. Groups to filter on. |
object of type "ggplot"
data.frame
# TODO
# TODO
Plot alignment scatterplot
plot_scatter_alignment_exposure( data, floor_outliers, cap_outliers, group_var, currency ) prep_scatter_alignment_exposure( data, year, region, scenario, group_var, exclude_groups = "benchmark" )
plot_scatter_alignment_exposure( data, floor_outliers, cap_outliers, group_var, currency ) prep_scatter_alignment_exposure( data, year, region, scenario, group_var, exclude_groups = "benchmark" )
data |
data.frame. Holds net aggregated alignment metrics on the loan
book level. Must contain columns: |
floor_outliers |
Numeric. Floor which should be applied to the alignment values in the data. Values smaller than floor are plotted on the border of the plot. |
cap_outliers |
Numeric. Cap which should be applied to the alignment values in the data. Values bigger than cap are plotted on the border of the plot. |
group_var |
Character. Vector of length 1. A column to group by. Must be
available variables in |
currency |
Character. Currency to display in the plot labels. |
year |
Integer. Year on which |
region |
Character. Region to filter |
scenario |
Character. Scenario to filter |
exclude_groups |
Character. Character specifying any values from
|
object of type "ggplot"
data.frame
# TODO
# TODO
Plot alignment scatterplot
plot_scatter_animated( data, data_level = c("company", "group_var"), sector = NULL, scenario_source = NULL, scenario = NULL, region = NULL, title = NULL, subtitle = NULL, alignment_limit = NULL, cap_outliers = NULL, floor_outliers = NULL ) prep_scatter_animated( data_bopo, data_net, data_level = c("group_var", "company"), sector, region, group_var, groups_to_plot = NULL )
plot_scatter_animated( data, data_level = c("company", "group_var"), sector = NULL, scenario_source = NULL, scenario = NULL, region = NULL, title = NULL, subtitle = NULL, alignment_limit = NULL, cap_outliers = NULL, floor_outliers = NULL ) prep_scatter_animated( data_bopo, data_net, data_level = c("group_var", "company"), sector, region, group_var, groups_to_plot = NULL )
data |
data.frame. Should have the same format as output of
|
data_level |
Character. Level of the plotted data. Can be |
sector |
Character. Sector to filter data on. |
scenario_source |
Character. Scenario source to be used in the plot caption. |
scenario |
Character. Scenario name to be used in the plot caption. |
region |
Character. Region to filter data on. |
title |
Character. Custom title if different than default. |
subtitle |
Character. Custom subtitle if different than default. |
alignment_limit |
Numeric. Limit to be applied to the x- and y-axis scales and to alignment values for colouring. By default the maximum absolute alignment value from data is used. |
cap_outliers |
Numeric. Cap which should be applied to the alignment values in the data. Values bigger than cap are plotted on the border of the plot. |
floor_outliers |
Numeric. Floor which should be applied to the alignment values in the data. Values smaller than floor are plotted on the border of the plot. |
data_bopo |
data.frame. Data containing buildout and phaseout alignment
values. Must contain columns: |
data_net |
data.frame. Data containing net alignment values. Must
contain columns: |
group_var |
Character. Vector of length 1. Variable to group by. |
groups_to_plot |
Character vector. Groups to filter on. |
object of type "plotly"
data.frame
# TODO
# TODO
run_pacta
run_pacta(config)
run_pacta(config)
config |
either a single string defining the path to a config YML file or a list object that contains the appropriate config params |
NULL
(called for side effects)