Package 'finRiskPractical'

Title: Teaching Scripts for Financial Risk Analytics Practicals
Description: A collection of ten worked practical scripts covering R fundamentals, term structure modelling, market risk (VaR), credit risk (Markov chains), operational risk (frequency-severity models), volatility (GARCH), portfolio optimisation, Monte Carlo risk simulation, and a Shiny risk dashboard. Each Practical*() function prints the annotated R code for that topic so it can be copied, run, and studied interactively. This package intentionally ships the material as printable teaching code rather than as executed computations, so it has no hard dependency on the packages used inside the printed examples (minpack.lm, evd, rugarch, quadprog, shiny); install those separately if you want to run the printed code yourself.
Authors: Phanthomx [aut, cre]
Maintainer: Phanthomx <[email protected]>
License: MIT + file LICENSE
Version: 0.1.0
Built: 2026-07-03 21:00:18 UTC
Source: https://github.com/phanthomx/finRiskPractical

Help Index


Practical 1: R for Finance

Description

Prints annotated R code covering basic R computations, data structures, a future value calculation, simple return simulation, and plots.

Usage

Practical1_R_for_Finance()

Value

Invisibly returns NULL; called for its printed side effect.

Examples

Practical1_R_for_Finance()

Practical 10: Build a Shiny Risk App

Description

Prints annotated R code for a full Shiny application (analytics, UI, and server layers) implementing an interactive Monte Carlo risk dashboard.

Usage

Practical10_Shiny_App()

Value

Invisibly returns NULL; called for its printed side effect.

Examples

Practical10_Shiny_App()

Practical 2: More R Warm-Ups

Description

Prints annotated R code covering functions, control flow, loops, bootstrapping a confidence interval, and a random walk simulation.

Usage

Practical2_R_Warmups()

Value

Invisibly returns NULL; called for its printed side effect.

Examples

Practical2_R_Warmups()

Practical 3: Term Structure and Splines

Description

Prints annotated R code fitting a Nelson-Siegel model and a cubic smoothing spline to a synthetic yield curve, and comparing RMSE.

Usage

Practical3_Term_Structure_Splines()

Value

Invisibly returns NULL; called for its printed side effect.

Examples

Practical3_Term_Structure_Splines()

Practical 4: Market Risk

Description

Prints annotated R code computing parametric and historical Value-at-Risk (VaR) on a simulated daily return series.

Usage

Practical4_Market_Risk()

Value

Invisibly returns NULL; called for its printed side effect.

Examples

Practical4_Market_Risk()

Practical 5: Credit Risk

Description

Prints annotated R code simulating rating migration with a Markov chain transition matrix, Monte Carlo default probabilities, and a hazard rate calculation.

Usage

Practical5_Credit_Risk()

Value

Invisibly returns NULL; called for its printed side effect.

Examples

Practical5_Credit_Risk()

Practical 6: Operational Risk

Description

Prints annotated R code for a frequency-severity operational loss model, fire loss severity, and a peaks-over-threshold (GPD) fit.

Usage

Practical6_Operational_Risk()

Value

Invisibly returns NULL; called for its printed side effect.

Examples

Practical6_Operational_Risk()

Practical 7: Measuring Volatility (GARCH)

Description

Prints annotated R code fitting an AR(1)-GARCH(1,1) model, simulating a future volatility path, and computing a GARCH-based VaR.

Usage

Practical7_Volatility_GARCH()

Value

Invisibly returns NULL; called for its printed side effect.

Examples

Practical7_Volatility_GARCH()

Practical 8: Portfolio Analytics

Description

Prints annotated R code solving a minimum-variance, long-only portfolio via quadratic programming and computing portfolio VaR.

Usage

Practical8_Portfolio_Analytics()

Value

Invisibly returns NULL; called for its printed side effect.

Examples

Practical8_Portfolio_Analytics()

Practical 9: Monte Carlo Risk Simulation

Description

Prints annotated R code simulating terminal asset values via Geometric Brownian Motion and computing Monte Carlo VaR and Expected Shortfall.

Usage

Practical9_Monte_Carlo_Risk()

Value

Invisibly returns NULL; called for its printed side effect.

Examples

Practical9_Monte_Carlo_Risk()