| Title: | Reproducible Risk-Weighted Asset Calculations |
|---|---|
| Description: | Provides transparent, deterministic and auditable calculations of risk-weighted assets, own-funds requirements, interest-rate risk in the banking book and related capital metrics. It supports canonical in-memory tables and versioned spreadsheet datasets, strict validation, synthetic reference profiles, bitemporal snapshots, calculation controls and traceable regulatory source metadata. A granular analyst API exposes individual formulae, domain views, controls, schemas and auditable parameter overrides. The implementation is intended for analytical, educational and model-validation use and does not constitute legal or supervisory advice. |
| Authors: | RiskDataScience GmbH [aut, cre, cph] |
| Maintainer: | RiskDataScience GmbH <[email protected]> |
| License: | GPL-3 |
| Version: | 1.2.3 |
| Built: | 2026-10-09 09:29:42 UTC |
| Source: | https://github.com/rds0001/risk-weighted-assets-r |
Analyse Capital Adequacy, Leverage and MREL/TLAC
analyze_capital_adequacy(x, view = c("applied", "fully_loaded"))analyze_capital_adequacy(x, view = c("applied", "fully_loaded"))
x |
Canonical tables or an existing calculation result. |
view |
|
An rwa_domain_analysis.
Analyse Counterparty Credit Risk, CVA and Settlement Risk
analyze_counterparty_risk(x, view = c("applied", "fully_loaded"))analyze_counterparty_risk(x, view = c("applied", "fully_loaded"))
x |
Canonical tables or an existing calculation result. |
view |
|
An rwa_domain_analysis.
Analyse Credit Risk
analyze_credit_risk(x, view = c("applied", "fully_loaded"))analyze_credit_risk(x, view = c("applied", "fully_loaded"))
x |
Canonical tables or an existing calculation result. |
view |
|
An rwa_domain_analysis with relevant metrics, tables and controls.
analyze_credit_risk(generate_synthetic_tables(bank_profile = "KSA_BANK"))analyze_credit_risk(generate_synthetic_tables(bank_profile = "KSA_BANK"))
Analyse ICAAP Economic and Normative Perspectives
analyze_icaap(x, view = c("applied", "fully_loaded"))analyze_icaap(x, view = c("applied", "fully_loaded"))
x |
Canonical tables or an existing calculation result. |
view |
|
An rwa_domain_analysis.
Analyse IRRBB and CSRBB
analyze_irrbb(x, view = c("applied", "fully_loaded"))analyze_irrbb(x, view = c("applied", "fully_loaded"))
x |
Canonical tables or an existing calculation result. |
view |
|
An rwa_domain_analysis.
Analyse Market Risk and FRTB
analyze_market_risk(x, view = c("applied", "fully_loaded"))analyze_market_risk(x, view = c("applied", "fully_loaded"))
x |
Canonical tables or an existing calculation result. |
view |
|
An rwa_domain_analysis.
Analyse Operational Risk
analyze_operational_risk(x, view = c("applied", "fully_loaded"))analyze_operational_risk(x, view = c("applied", "fully_loaded"))
x |
Canonical tables or an existing calculation result. |
view |
|
An rwa_domain_analysis.
Analyse the Output Floor
analyze_output_floor(x, view = c("applied", "fully_loaded"))analyze_output_floor(x, view = c("applied", "fully_loaded"))
x |
Canonical tables or an existing calculation result. |
view |
|
An rwa_domain_analysis.
Analyse Securitisation Risk
analyze_securitisation(x, view = c("applied", "fully_loaded"))analyze_securitisation(x, view = c("applied", "fully_loaded"))
x |
Canonical tables or an existing calculation result. |
view |
|
An rwa_domain_analysis.
Apply Credit Supporting Factors
apply_credit_supporting_factors( rwea, sme_factor = 1, infrastructure_factor = 1 )apply_credit_supporting_factors( rwea, sme_factor = 1, infrastructure_factor = 1 )
rwea |
Non-negative risk-weighted exposure amount before supporting factors. |
sme_factor, infrastructure_factor
|
Separate factors in (0, 1]. |
Both factors may apply together if both sets of legal criteria are fulfilled. This arithmetic helper does not attest eligibility.
RWEA after multiplying the factors once.
apply_credit_supporting_factors(100, 0.7619, 0.75)apply_credit_supporting_factors(100, 0.7619, 0.75)
Convert a Validation Report to a Data Frame
## S3 method for class 'rwa_validation_report' as.data.frame(x, row.names = NULL, optional = FALSE, ...)## S3 method for class 'rwa_validation_report' as.data.frame(x, row.names = NULL, optional = FALSE, ...)
x |
An |
row.names |
Unused compatibility argument. |
optional |
Unused compatibility argument. |
... |
Unused. |
A data frame with one row per structured validation message.
Available Rule Sets
available_rule_sets(tables = NULL)available_rule_sets(tables = NULL)
tables |
Optional canonical tables; bundled reference tables are used otherwise. |
The rule-set data frame.
available_rule_sets()available_rule_sets()
Operational Risk, Output Floor, NPE and Tier-2 Formulae
business_indicator_component( il, ie, assets, dividends, oi, oe, fi, fe, trading_pnl, banking_pnl, parameters = NULL ) applicable_output_floor_factor(as_of, fully_loaded = FALSE, parameters = NULL) apply_output_floor( u_trea, s_trea, factor, optional_cap = FALSE, cap_multiplier = 1 ) npe_unsecured_coverage_factor(year, parameters = NULL) npe_secured_coverage_factor(year, property_security = TRUE, parameters = NULL) tier2_eligible_amount( current_amount, first_day_amount, maturity, as_of, parameters = NULL )business_indicator_component( il, ie, assets, dividends, oi, oe, fi, fe, trading_pnl, banking_pnl, parameters = NULL ) applicable_output_floor_factor(as_of, fully_loaded = FALSE, parameters = NULL) apply_output_floor( u_trea, s_trea, factor, optional_cap = FALSE, cap_multiplier = 1 ) npe_unsecured_coverage_factor(year, parameters = NULL) npe_secured_coverage_factor(year, property_security = TRUE, parameters = NULL) tier2_eligible_amount( current_amount, first_day_amount, maturity, as_of, parameters = NULL )
il, ie, assets, dividends, oi, oe, fi, fe, trading_pnl, banking_pnl
|
Numeric vectors for the business-indicator components. |
parameters |
Optional parameter data frame or store. |
as_of |
Reporting date. |
fully_loaded |
Whether to return the fully-loaded floor factor. |
u_trea |
Unfloored TREA. |
s_trea |
Standardised TREA. |
factor |
Output-floor factor. |
optional_cap |
Whether an optional cap applies. |
cap_multiplier |
Cap multiple of unfloored TREA. |
year |
NPE vintage year. |
property_security |
Whether secured by property. |
current_amount, first_day_amount
|
Tier-2 instrument amounts. |
maturity |
Tier-2 maturity date. |
Numeric, named numeric vector, or output-floor result list.
apply_output_floor(100, 180, 0.725, FALSE, 1) applicable_output_floor_factor(as.Date("2026-12-31"), FALSE)apply_output_floor(100, 180, 0.725, FALSE, 1) applicable_output_floor_factor(as.Date("2026-12-31"), FALSE)
Validates a dataset, creates an immutable deterministic run directory and writes six structured output workbooks plus a JSON run manifest.
calculate_dataset(dataset)calculate_dataset(dataset)
dataset |
Dataset directory containing an |
Output is written below dataset/outputs/<run-id>. The run ID
fingerprints the input files, code and package version.
An rwa_calculation_result object with output paths.
validate_dataset(), generate_synthetic_dataset()
root <- file.path(tempdir(), "rwa-calculation-example") dataset <- generate_synthetic_dataset(root, bank_profile = "KSA_BANK") calculate_dataset(dataset)root <- file.path(tempdir(), "rwa-calculation-example") dataset <- generate_synthetic_dataset(root, bank_profile = "KSA_BANK") calculate_dataset(dataset)
Validates and calculates canonical tables without producing spreadsheet output. A parallel fully-loaded result is calculated from the same snapshot.
calculate_tables( tables, run_id = NULL, project_root = NULL, parameter_overrides = NULL, override_reason = NULL, override_approved_by = NULL )calculate_tables( tables, run_id = NULL, project_root = NULL, parameter_overrides = NULL, override_reason = NULL, override_approved_by = NULL )
tables |
Named list of canonical data frames. |
run_id |
Optional caller-defined run identifier. |
project_root |
Optional root used to resolve local source documents. |
parameter_overrides |
Optional data frame of controlled parameter
overrides prepared as described in |
override_reason, override_approved_by
|
Required non-empty governance
information when |
The return includes applied and fully-loaded result tables. All
calculations use one official bitemporal snapshot. The function does not
write files and does not change the global random-number stream.
Exposure default_flag values are normalised once on the selected snapshot.
Accepted inputs are logicals, numeric 0/1, and case-insensitive strings
TRUE/FALSE, 1/0, 1.0/0.0, YES/NO or JA/NEIN (whitespace is trimmed).
Missing or unknown values fail closed. Both SA and IRB detail tables expose
the effective status in defaulted, shared by both reporting views.
An rwa_calculation_result object.
generate_synthetic_tables(), calculate_dataset()
tables <- generate_synthetic_tables(bank_profile = "KSA_BANK") result <- calculate_tables(tables) result$metrics[c("RWEA_KSA", "TREA")]tables <- generate_synthetic_tables(bank_profile = "KSA_BANK") result <- calculate_tables(tables) result$metrics[c("RWEA_KSA", "TREA")]
Compare Applied and Fully-loaded Metrics
compare_calculation_views(result)compare_calculation_views(result)
result |
An |
A data frame with both values and their difference.
r <- calculate_tables(generate_synthetic_tables(bank_profile = "KSA_BANK")) compare_calculation_views(r)r <- calculate_tables(generate_synthetic_tables(bank_profile = "KSA_BANK")) compare_calculation_views(r)
Exports the package's synthetic reference environment to a caller-controlled
directory. Existing non-empty directories require explicit overwrite.
create_workspace(path, overwrite = FALSE)create_workspace(path, overwrite = FALSE)
path |
Destination directory. |
overwrite |
Whether existing files may be replaced. |
An rwa_workspace object.
workspace <- create_workspace(file.path(tempdir(), "rwa-example"), overwrite = TRUE) print(workspace)workspace <- create_workspace(file.path(tempdir(), "rwa-example"), overwrite = TRUE) print(workspace)
Uses RWA_WORKSPACE when it is set, otherwise a rwa-workspace directory
below the current working directory. The function only describes the path;
it does not create or modify it.
default_workspace()default_workspace()
An rwa_workspace object.
default_workspace()default_workspace()
Failed Calculation Controls
failed_controls(result, view = c("applied", "fully_loaded"))failed_controls(result, view = c("applied", "fully_loaded"))
result |
An |
view |
|
A data frame containing only failed controls.
r <- calculate_tables(generate_synthetic_tables(bank_profile = "KSA_BANK")) failed_controls(r)r <- calculate_tables(generate_synthetic_tables(bank_profile = "KSA_BANK")) failed_controls(r)
Formula Catalogue
formula_catalog(tables = NULL)formula_catalog(tables = NULL)
tables |
Optional canonical tables; bundled reference tables are used otherwise. |
The versioned formula-definition data frame.
head(formula_catalog())head(formula_catalog())
Generate a Synthetic Workbook Dataset
generate_synthetic_dataset( root, as_of = NULL, version = NULL, seed = NULL, bank_profile = "MID_SIZE_UNIVERSAL", config_root = NULL, overwrite = FALSE )generate_synthetic_dataset( root, as_of = NULL, version = NULL, seed = NULL, bank_profile = "MID_SIZE_UNIVERSAL", config_root = NULL, overwrite = FALSE )
root |
Parent directory for dated datasets. |
as_of |
Reporting date. |
version |
Dataset version. |
seed |
Integer lineage seed. |
bank_profile |
Profile identifier. |
config_root |
Optional profile configuration directory. |
overwrite |
Whether an existing dataset may be replaced. |
The function writes 16 canonical workbooks plus a dataset manifest.
An existing non-empty target requires overwrite = TRUE.
The generated dataset directory.
validate_dataset(), calculate_dataset()
generate_synthetic_dataset(file.path(tempdir(), "rwa-runs"), bank_profile = "KSA_BANK")generate_synthetic_dataset(file.path(tempdir(), "rwa-runs"), bank_profile = "KSA_BANK")
Materializes a complete synthetic banking profile from immutable package fixtures. The seed is recorded for lineage; no business distributions are generated at runtime.
generate_synthetic_tables( as_of = NULL, seed = NULL, bank_profile = "MID_SIZE_UNIVERSAL", config_root = NULL )generate_synthetic_tables( as_of = NULL, seed = NULL, bank_profile = "MID_SIZE_UNIVERSAL", config_root = NULL )
as_of |
Reporting date. Defaults to the profile base date. |
seed |
Integer lineage seed. |
bank_profile |
Profile identifier. |
config_root |
Optional directory containing profile YAML files. |
A named list of canonical data frames.
calculate_tables(), generate_synthetic_dataset()
tables <- generate_synthetic_tables(bank_profile = "KSA_BANK") length(tables)tables <- generate_synthetic_tables(bank_profile = "KSA_BANK") length(tables)
Infrastructure Supporting Factor under Article 501a CRR
infrastructure_supporting_factor(parameters = NULL)infrastructure_supporting_factor(parameters = NULL)
parameters |
Optional governed parameter table or parameter store. |
Eligibility under all Article 501a criteria must be established separately. This function returns the configured factor, not an approval.
Numeric infrastructure supporting factor.
infrastructure_supporting_factor()infrastructure_supporting_factor()
Direct access to IRB asset correlations, maturity adjustment and capital requirement. Probability, LGD and correlation inputs are decimal rates.
irb_asset_correlation( pd, annual_sales_million = NULL, financial_multiplier = FALSE, parameters = NULL ) irb_retail_correlation(pd, subclass, parameters = NULL) irb_maturity_coefficient(pd, parameters = NULL) irb_maturity_factor(pd, maturity, parameters = NULL) irb_capital_requirement( pd, lgd, correlation, maturity, apply_maturity_adjustment = TRUE, defaulted = FALSE, elbe = 0, parameters = NULL, lgd_treatment = NULL )irb_asset_correlation( pd, annual_sales_million = NULL, financial_multiplier = FALSE, parameters = NULL ) irb_retail_correlation(pd, subclass, parameters = NULL) irb_maturity_coefficient(pd, parameters = NULL) irb_maturity_factor(pd, maturity, parameters = NULL) irb_capital_requirement( pd, lgd, correlation, maturity, apply_maturity_adjustment = TRUE, defaulted = FALSE, elbe = 0, parameters = NULL, lgd_treatment = NULL )
pd |
Probability of default. |
annual_sales_million |
Optional annual sales in millions. |
financial_multiplier |
Whether to apply the financial-sector multiplier. |
parameters |
Optional parameter data frame or store. |
subclass |
Retail exposure subclass. |
maturity |
Effective maturity in years. |
lgd |
Loss given default. |
correlation |
Asset correlation. |
apply_maturity_adjustment |
Whether the maturity adjustment applies. |
defaulted |
Whether the exposure is defaulted. |
elbe |
Best estimate of expected loss for a defaulted exposure. |
lgd_treatment |
Required for defaults: |
One numeric coefficient or capital-requirement rate.
irb_asset_correlation(0.01) irb_capital_requirement(0.01, 0.45, 0.20, 2.5, TRUE, FALSE, 0)irb_asset_correlation(0.01) irb_capital_requirement(0.01, 0.45, 0.20, 2.5, TRUE, FALSE, 0)
IRB Risk-Weighted Exposure Amount including Supporting Factors
irb_risk_weighted_assets( ead, capital_requirement, sme_factor = 1, infrastructure_factor = 1, parameters = NULL )irb_risk_weighted_assets( ead, capital_requirement, sme_factor = 1, infrastructure_factor = 1, parameters = NULL )
ead |
Non-negative exposure at default. |
capital_requirement |
Non-negative unadjusted K rate, for example from
|
sme_factor, infrastructure_factor
|
Separate factors in (0, 1]. |
parameters |
Optional governed parameter table or parameter store. |
This helper does not change K, PD, LGD or expected loss. Its caller establishes eligibility; the table calculation API requires supporting evidence.
EAD times configured RWA multiplier times K times both factors.
irb_risk_weighted_assets(1000000, 0.08, infrastructure_factor = 0.75)irb_risk_weighted_assets(1000000, 0.08, infrastructure_factor = 0.75)
IRRBB, FRTB and Economic-capital Formulae
irrbb_scenario_shock(scenario, t, parallel, short, long, parameters = NULL) irrbb_shocked_zero_rate(base, shock, t, parameters = NULL) present_value_discount_factor(continuous_zero_rate, t) aggregate_correlated_capital(capitals, correlation) frtb_scenario_correlation(base, scenario, parameters = NULL) frtb_quadratic_charge(values, correlation, curvature = FALSE)irrbb_scenario_shock(scenario, t, parallel, short, long, parameters = NULL) irrbb_shocked_zero_rate(base, shock, t, parameters = NULL) present_value_discount_factor(continuous_zero_rate, t) aggregate_correlated_capital(capitals, correlation) frtb_scenario_correlation(base, scenario, parameters = NULL) frtb_quadratic_charge(values, correlation, curvature = FALSE)
scenario |
IRRBB or FRTB correlation scenario. |
t |
Time in years. |
parallel, short, long
|
Scenario shocks as decimal rates. |
parameters |
Optional parameter data frame or store. |
base |
Base continuously compounded zero rate or base correlation. |
shock |
Rate shock. |
continuous_zero_rate |
Continuously compounded zero rate. |
capitals |
Vector of standalone capital amounts. |
correlation |
Correlation matrix or scalar intra-bucket correlation. |
values |
Weighted sensitivities. |
curvature |
Whether curvature aggregation applies. |
Numeric shock, rate, discount factor or aggregated capital.
present_value_discount_factor(0.03, 5) aggregate_correlated_capital(c(10, 20), matrix(c(1, .25, .25, 1), 2))present_value_discount_factor(0.03, 5) aggregate_correlated_capital(c(10, 20), matrix(c(1, .25, .25, 1), 2))
List Bundled Reference Datasets
list_reference_datasets()list_reference_datasets()
A data frame with dataset identifiers and versions.
list_reference_datasets()list_reference_datasets()
Returns metadata for every synthetic reference profile included with the package. No customer or production data is included.
list_reference_profiles()list_reference_profiles()
A data frame with profile identifiers, versions, base dates, seeds, default dataset versions and descriptions.
list_reference_profiles()list_reference_profiles()
Select the Official Bitemporal Snapshot
official_snapshot(tables, as_of_date = NULL, knowledge_time = NULL)official_snapshot(tables, as_of_date = NULL, knowledge_time = NULL)
tables |
Canonical table list. |
as_of_date |
Optional business date; defaults to |
knowledge_time |
Optional knowledge timestamp; defaults to |
The time-of-day is preserved, including when read from run_config.
The same timestamp parser is used by calculate_tables().
Canonical tables reduced to the effective official records.
t <- generate_synthetic_tables(bank_profile = "KSA_BANK") s <- official_snapshot(t)t <- generate_synthetic_tables(bank_profile = "KSA_BANK") s <- official_snapshot(t)
Creates a modified copy of canonical tables. Existing parameter rows are replaced only when key and both dimensions identify exactly one row. The original input is not mutated and an audit record is attached.
override_regulatory_parameters(tables, overrides, reason, approved_by)override_regulatory_parameters(tables, overrides, reason, approved_by)
tables |
Canonical input tables. |
overrides |
Data frame with |
reason |
Non-empty business rationale. |
approved_by |
Non-empty approver or governance reference. |
A copied table list carrying an rwa_parameter_overrides audit attribute.
parameter_overrides(), calculate_tables()
t <- generate_synthetic_tables(bank_profile = "KSA_BANK") o <- data.frame(parameter_key = "RWA_MULTIPLIER", dimension_1 = "PILLAR1", dimension_2 = "", parameter_value = 12.5) t2 <- override_regulatory_parameters(t, o, "Sensitivity", "Model Risk") parameter_overrides(t2)t <- generate_synthetic_tables(bank_profile = "KSA_BANK") o <- data.frame(parameter_key = "RWA_MULTIPLIER", dimension_1 = "PILLAR1", dimension_2 = "", parameter_value = 12.5) t2 <- override_regulatory_parameters(t, o, "Sensitivity", "Model Risk") parameter_overrides(t2)
Parameter Override Audit Trail
parameter_overrides(x)parameter_overrides(x)
x |
Canonical tables or an |
A data frame of old/new values and governance information.
override_regulatory_parameters()
parameter_overrides(generate_synthetic_tables(bank_profile = "KSA_BANK"))parameter_overrides(generate_synthetic_tables(bank_profile = "KSA_BANK"))
Print a Calculation Result
## S3 method for class 'rwa_calculation_result' print(x, ...)## S3 method for class 'rwa_calculation_result' print(x, ...)
x |
An |
... |
Unused. |
x, invisibly.
Print a Domain Analysis
## S3 method for class 'rwa_domain_analysis' print(x, ...)## S3 method for class 'rwa_domain_analysis' print(x, ...)
x |
An |
... |
Unused. |
x, invisibly.
Print a Validation Report
## S3 method for class 'rwa_validation_report' print(x, ...)## S3 method for class 'rwa_validation_report' print(x, ...)
x |
An |
... |
Unused. |
x, invisibly.
Print a Workspace
## S3 method for class 'rwa_workspace' print(x, ...)## S3 method for class 'rwa_workspace' print(x, ...)
x |
An |
... |
Unused. |
x, invisibly.
Read One Regulatory Parameter
regulatory_parameter( key, dimension_1 = "", dimension_2 = "", parameters = NULL )regulatory_parameter( key, dimension_1 = "", dimension_2 = "", parameters = NULL )
key |
Regulatory parameter key. |
dimension_1, dimension_2
|
Optional parameter dimensions. |
parameters |
A parameter-store object or parameter data frame. Bundled regulatory defaults are used when omitted. |
One numeric parameter value.
regulatory_parameter("RWA_MULTIPLIER", "PILLAR1")regulatory_parameter("RWA_MULTIPLIER", "PILLAR1")
Returns the effective parameter table used by granular formulas. Analysts can inspect every weight and coefficient before calculation.
regulatory_parameters(tables = NULL)regulatory_parameters(tables = NULL)
tables |
Optional canonical table list. If omitted, bundled defaults are used. |
A data frame containing parameter keys, dimensions and values.
regulatory_parameter(), override_regulatory_parameters()
head(regulatory_parameters())head(regulatory_parameters())
Returns links and archived checksums for official sources used to design the engine. The source documents themselves are deliberately not redistributed.
regulatory_sources()regulatory_sources()
A data frame. The redistributed column is always false for the
bundled metadata.
regulatory_sources()regulatory_sources()
Calculation Controls
rwa_controls(result, view = c("applied", "fully_loaded"))rwa_controls(result, view = c("applied", "fully_loaded"))
result |
An |
view |
|
A data frame containing reconciliation and governance controls.
r <- calculate_tables(generate_synthetic_tables(bank_profile = "KSA_BANK")) rwa_controls(r)r <- calculate_tables(generate_synthetic_tables(bank_profile = "KSA_BANK")) rwa_controls(r)
Read One Calculation Metric
rwa_metric(result, metric, view = c("applied", "fully_loaded"))rwa_metric(result, metric, view = c("applied", "fully_loaded"))
result |
An |
metric |
Metric identifier. |
view |
|
One numeric value.
r <- calculate_tables(generate_synthetic_tables(bank_profile = "KSA_BANK")) rwa_metric(r, "CET1_RATIO")r <- calculate_tables(generate_synthetic_tables(bank_profile = "KSA_BANK")) rwa_metric(r, "CET1_RATIO")
Calculation Metrics
rwa_metrics(result, view = c("applied", "fully_loaded"))rwa_metrics(result, view = c("applied", "fully_loaded"))
result |
An |
view |
|
A tidy data frame with metric, value, unit and view.
rwa_metric(), compare_calculation_views()
r <- calculate_tables(generate_synthetic_tables(bank_profile = "KSA_BANK")) rwa_metrics(r)r <- calculate_tables(generate_synthetic_tables(bank_profile = "KSA_BANK")) rwa_metrics(r)
Read One Result Table
rwa_result_table(result, table, view = c("applied", "fully_loaded"))rwa_result_table(result, table, view = c("applied", "fully_loaded"))
result |
An |
table |
Result-table name. |
view |
|
A result data frame.
r <- calculate_tables(generate_synthetic_tables(bank_profile = "KSA_BANK")) rwa_result_table(r, "Capital_Stack")r <- calculate_tables(generate_synthetic_tables(bank_profile = "KSA_BANK")) rwa_result_table(r, "Capital_Stack")
Result Tables
rwa_result_tables(result, view = c("applied", "fully_loaded"))rwa_result_tables(result, view = c("applied", "fully_loaded"))
result |
An |
view |
|
A named list of result data frames.
rwa_result_table(), rwa_table_names()
r <- calculate_tables(generate_synthetic_tables(bank_profile = "KSA_BANK")) names(rwa_result_tables(r))r <- calculate_tables(generate_synthetic_tables(bank_profile = "KSA_BANK")) names(rwa_result_tables(r))
Compact Calculation Summary
rwa_summary(result)rwa_summary(result)
result |
An |
A list with identity, core metrics, controls and overrides.
r <- calculate_tables(generate_synthetic_tables(bank_profile = "KSA_BANK")) rwa_summary(r)r <- calculate_tables(generate_synthetic_tables(bank_profile = "KSA_BANK")) rwa_summary(r)
List Result-Table Names
rwa_table_names(result, view = c("applied", "fully_loaded"))rwa_table_names(result, view = c("applied", "fully_loaded"))
result |
An |
view |
|
Character vector of result-table names.
r <- calculate_tables(generate_synthetic_tables(bank_profile = "KSA_BANK")) rwa_table_names(r)r <- calculate_tables(generate_synthetic_tables(bank_profile = "KSA_BANK")) rwa_table_names(r)
Calculation Validation Report
rwa_validation(result)rwa_validation(result)
result |
An |
The rwa_validation_report attached to the result.
r <- calculate_tables(generate_synthetic_tables(bank_profile = "KSA_BANK")) rwa_validation(r)r <- calculate_tables(generate_synthetic_tables(bank_profile = "KSA_BANK")) rwa_validation(r)
Granular formula interface for SA-CCR, SFT, securitisation approaches, BA-CVA and settlement risk. Rates are decimal values.
sa_ccr_multiplier_value(V, C, addon, parameters = NULL) sa_ccr_exposure_value(V, C, addon, alpha, parameters = NULL) sft_exposure_value(cash_leg, security_value, security_haircut, fx_haircut) securitisation_irb_pool_capital( rwea_pool_irb_ul, el_pool_irb, pool_ead, parameters = NULL ) securitisation_sa_pool_capital(rwea_pool_sa, pool_ead, parameters = NULL) securitisation_ssfa_coefficient(ka, attachment, detachment, p) securitisation_ssfa_risk_weight( pool_k, attachment, detachment, p, floor, parameters = NULL ) securitisation_irba_p( pool_type, senior, effective_number, pool_k, average_lgd, tranche_maturity, sts, parameters = NULL ) securitisation_erba_risk_weight( cqs, maturity, senior, sts, attachment, detachment, parameters = NULL ) securitisation_risk_weight( approach, pool_k, attachment, detachment, p, sts = FALSE, senior = FALSE, resecuritisation = FALSE, cqs = 0, parameters = NULL ) cva_basic_approach_capital(items, parameters = NULL) settlement_risk_factor(days_late, parameters = NULL)sa_ccr_multiplier_value(V, C, addon, parameters = NULL) sa_ccr_exposure_value(V, C, addon, alpha, parameters = NULL) sft_exposure_value(cash_leg, security_value, security_haircut, fx_haircut) securitisation_irb_pool_capital( rwea_pool_irb_ul, el_pool_irb, pool_ead, parameters = NULL ) securitisation_sa_pool_capital(rwea_pool_sa, pool_ead, parameters = NULL) securitisation_ssfa_coefficient(ka, attachment, detachment, p) securitisation_ssfa_risk_weight( pool_k, attachment, detachment, p, floor, parameters = NULL ) securitisation_irba_p( pool_type, senior, effective_number, pool_k, average_lgd, tranche_maturity, sts, parameters = NULL ) securitisation_erba_risk_weight( cqs, maturity, senior, sts, attachment, detachment, parameters = NULL ) securitisation_risk_weight( approach, pool_k, attachment, detachment, p, sts = FALSE, senior = FALSE, resecuritisation = FALSE, cqs = 0, parameters = NULL ) cva_basic_approach_capital(items, parameters = NULL) settlement_risk_factor(days_late, parameters = NULL)
V, C
|
Current value and collateral under SA-CCR. |
addon |
Aggregate SA-CCR add-on. |
parameters |
Optional parameter data frame or store. |
alpha |
SA-CCR regulatory alpha. |
cash_leg, security_value
|
Monetary SFT legs. |
security_haircut, fx_haircut
|
Haircuts. |
rwea_pool_irb_ul, el_pool_irb, rwea_pool_sa, pool_ead
|
Pool inputs. |
ka, pool_k
|
Pool capital ratio. |
attachment, detachment
|
Tranche attachment and detachment points. |
p |
Supervisory SSFA parameter. |
floor |
Minimum risk weight. |
pool_type |
Pool category. |
senior, sts, resecuritisation
|
Logical tranche flags. |
effective_number |
Effective number of pool exposures. |
average_lgd |
Average pool LGD. |
tranche_maturity, maturity
|
Maturity in years. |
cqs |
Credit-quality step. |
approach |
Securitisation approach. |
items |
BA-CVA rows, each with the documented nine numeric fields. |
days_late |
Settlement delay in days. |
Numeric formula result or named vector.
analyze_counterparty_risk(), analyze_securitisation()
sa_ccr_exposure_value(100, 30, 20, 1.4) sft_exposure_value(100, 90, 0.1, 0.05)sa_ccr_exposure_value(100, 30, 20, 1.4) sft_exposure_value(100, 90, 0.1, 0.05)
Granular, side-effect-free formulae for exposure value, risk weights, real estate treatment and credit-risk mitigation. Rates and weights are decimals. Monetary inputs and outputs use one caller-selected currency consistently.
sa_exposure_value( gross_carrying_amount, specific_adjustments = 0, additional_valuation_adjustments = 0, other_own_funds_reductions = 0, committed_undrawn = 0, annex_i_class, data_path = "GROSS_COMPONENTS", net_carrying_amount_article_111 = NULL, parameters = NULL ) sa_risk_weight( exposure_class, cqs = NULL, short_term = FALSE, transactor = FALSE, retail_eligible = FALSE, defaulted = FALSE, default_coverage_ratio = 0, specialised_lending_type = "", parameters = NULL ) real_estate_risk_weight( ead, property_value, property_type, ipre, counterparty_rw, senior_liens = 0, adc = FALSE, parameters = NULL ) crm_maturity_factor(t_protection, t_exposure, minimum_t = 0.25, maximum_T = 5) crm_adjusted_exposure(exposure, collateral, he, hc, hfx)sa_exposure_value( gross_carrying_amount, specific_adjustments = 0, additional_valuation_adjustments = 0, other_own_funds_reductions = 0, committed_undrawn = 0, annex_i_class, data_path = "GROSS_COMPONENTS", net_carrying_amount_article_111 = NULL, parameters = NULL ) sa_risk_weight( exposure_class, cqs = NULL, short_term = FALSE, transactor = FALSE, retail_eligible = FALSE, defaulted = FALSE, default_coverage_ratio = 0, specialised_lending_type = "", parameters = NULL ) real_estate_risk_weight( ead, property_value, property_type, ipre, counterparty_rw, senior_liens = 0, adc = FALSE, parameters = NULL ) crm_maturity_factor(t_protection, t_exposure, minimum_t = 0.25, maximum_T = 5) crm_adjusted_exposure(exposure, collateral, he, hc, hfx)
gross_carrying_amount, specific_adjustments, additional_valuation_adjustments, other_own_funds_reductions
|
Monetary amounts. |
committed_undrawn |
Undrawn commitment amount. |
annex_i_class |
CRR Annex I conversion-factor class. |
data_path |
|
net_carrying_amount_article_111 |
Optional net carrying amount. |
parameters |
Optional parameter data frame or |
exposure_class, cqs
|
Exposure class and credit-quality step. |
short_term, transactor, retail_eligible, defaulted
|
Logical classification flags. |
default_coverage_ratio |
Coverage ratio for defaulted exposures. |
specialised_lending_type |
Optional specialised-lending category. |
ead, property_value, senior_liens
|
Monetary real-estate inputs. |
property_type |
Property category. |
ipre, adc
|
Logical real-estate flags. |
counterparty_rw |
Counterparty risk weight. |
t_protection, t_exposure, minimum_t, maximum_T
|
Maturity-mismatch inputs in years. |
exposure, collateral
|
Exposure and collateral values. |
he, hc, hfx
|
Exposure, collateral and currency haircuts. |
Numeric value, named numeric vector, or documented list depending on the formula.
regulatory_parameters(), override_regulatory_parameters()
sa_exposure_value(100, 2, 0, 0, 40, "CLASS_2", "GROSS_COMPONENTS") crm_adjusted_exposure(100, 60, 0.05, 0.10, 0.08)sa_exposure_value(100, 2, 0, 0, 40, "CLASS_2", "GROSS_COMPONENTS") crm_adjusted_exposure(100, 60, 0.05, 0.10, 0.08)
Returns a modified copy of canonical tables with the requested rule set in
run_config; it never mutates the caller's object.
select_rule_set(tables, rule_set_id)select_rule_set(tables, rule_set_id)
tables |
Canonical input tables. |
rule_set_id |
Identifier listed by |
Modified canonical tables.
t <- generate_synthetic_tables(bank_profile = "KSA_BANK") t <- select_rule_set(t, "CRR3-EU-FL")t <- generate_synthetic_tables(bank_profile = "KSA_BANK") t <- select_rule_set(t, "CRR3-EU-FL")
SME Supporting Factor under Article 501 CRR
sme_supporting_factor(total_amount_owed_eur, parameters = NULL)sme_supporting_factor(total_amount_owed_eur, parameters = NULL)
total_amount_owed_eur |
Positive Article 501 E* amount in EUR, including the prescribed connected-client/institution-group aggregation and residential collateral exclusion/fallback. This is not necessarily the individual EAD. |
parameters |
Optional governed parameter table or parameter store. |
This pure numeric function does not certify legal eligibility. The threshold and lower/upper rates are read from SUPPORTING_FACTOR parameters.
Numeric weighted SME supporting factor.
sme_supporting_factor(5000000)sme_supporting_factor(5000000)
Canonical Table Dictionary
table_dictionary()table_dictionary()
A data frame describing all logical tables, workbooks and sheets.
head(table_dictionary())head(table_dictionary())
Canonical Table Schema
table_schema(table)table_schema(table)
table |
Logical table name from |
A list with workbook, sheet, Excel table, required flag and columns.
table_schema("exposure_lot")table_schema("exposure_lot")
Reads and validates all canonical input workbooks without calculating or writing any output files.
validate_dataset(dataset)validate_dataset(dataset)
dataset |
Dataset directory containing an |
An rwa_validation_report object.
calculate_dataset(), generate_synthetic_dataset()
root <- file.path(tempdir(), "rwa-validation-example") dataset <- generate_synthetic_dataset(root, bank_profile = "KSA_BANK") as.data.frame(validate_dataset(dataset))root <- file.path(tempdir(), "rwa-validation-example") dataset <- generate_synthetic_dataset(root, bank_profile = "KSA_BANK") as.data.frame(validate_dataset(dataset))