This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jarquebera <- function(x){ | |
#' Test for normality Jarque-Bera, Bowman-Shenton(1977)) | |
#' | |
#' Calculates Jarque-Bera Normality test & corresponding p-value | |
#' @param x a Nx1 vector | |
#' @return Jarque-Bera statistic | |
#' @export | |
#' @author Alexandros Gabrielsen | |
T=length(x) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bintest = function(ci, pds, freq, obspds, statistic) { | |
# --------------------------------------------------------------- | |
# PURPOSE: | |
# Binomial Test: Upper One/Two Tailed Upper Bounds Assuming Independence | |
# --------------------------------------------------------------- | |
# INPUS: | |
# ci Confidence Interval | |
# pds Expected PDs | |
# freq Frequency of ratings | |
# obspds Observed PDs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Gini = function(freq, default, saveplot, showplot) { | |
# --------------------------------------------------------------- | |
# PURPOSE: | |
# PD Accuracy Ration (Gini) | |
# Basel Committee on Banking Supervision | |
# Working Paper No. 14 | |
# Studies on the Validation of Internal Rating Systems | |
# --------------------------------------------------------------- | |
# INPUTS: | |
# freq Frequency |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HosmerLemeshow = function(freq,obspds,ci) { | |
# --------------------------------------------------------------- | |
# PURPOSE: | |
# Hosmer Lemeshow Test | |
# Basel Committee on Banking Supervision | |
# Working Paper No. 14 | |
# Studies on the Validation of Internal Rating Systems | |
# --------------------------------------------------------------- | |
# INPUTS: | |
# freq Frequency |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
KendallTau = function(X,Y,type) { | |
# --------------------------------------------------------------- | |
# PURPOSE: | |
# Kendall Tau | |
# Basel Committee on Banking Supervision | |
# Working Paper No. 14 | |
# Studies on the Validation of Internal Rating Systems | |
# | |
# --------------------------------------------------------------- | |
# INPUTS: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PSI = function(X,Y,saveplot,showplot,ratings,psinames) { | |
# --------------------------------------------------------------- | |
# PURPOSE: | |
# Population Distribution Index (PSI) | |
# Basel Committee on Banking Supervision | |
# Working Paper No. 14 | |
# Studies on the Validation of Internal Rating Systems | |
# --------------------------------------------------------------- | |
# INPUTS: | |
# X Array of (%) of Frequency |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--------------------------------------------------------------- | |
# PURPOSE: | |
# Pluto and Tasche, 2005, Estimating Probabilities of Default for | |
# Low Default Portfolios | |
# Basel Committee on Banking Supervision | |
# Working Paper No. 14 | |
# Studies on the Validation of Internal Rating Systems | |
# --------------------------------------------------------------- | |
# INPUTS: | |
# n number of obligors for a particular grade |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VaRLR <-function(fdata, VaR, alpha, position) { | |
# | |
#----------------------------------------------------------------------- | |
# PURPOSE: | |
# Value-at-Risk backtesting for long and short positions using | |
# the unconditional coverage, independence and conditional coverage family | |
# of tests | |
#----------------------------------------------------------------------- | |
# USAGE: | |
# results = VaRLR(fdata, VaR, alpha, position, options) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Exponentially Weighted Moving Average | |
# ---------------------------------------------------- | |
# PURPOSE: | |
# Estimates the Exponentially Weighted Moving Average. | |
#--------------------------------------------------- | |
# USAGE: | |
# [M, V, H, C] = ewma(data,lambda, method) | |
# | |
# INPUTS: | |
# data = ( M x N ) vector |