transForecast_svm: Forecast - using Support Vector Machines

Description Usage Arguments Value Author(s) Examples

Description

This model implements a forecasting method using Support Vector Machines.

Usage

1
2
3
transForecast_svm(data, histData, predData_svm, startDate, endDate,
                    method, interval, snapshots, defind, depVar, indVars,  ratingCat, 
                    pct, tuning, kernelType, cost, cost.weights, gamma, gamma.weights)

Arguments

data

a table containing historical credit ratings data (i.e., credit migration data). A dataframe of size nRecords x 3 where each row contains an ID (column 1), a date (column 2), and a credit rating (column 3); The credit rating is the rating assigned to the corresponding ID on the corresponding date.

histData

historical macroeconomic,financial and non-financial data.

predData_svm

forecasting data.

startDate

start date of the estimation time window, in string or numeric format.

endDate

end date of the estimation time window, in string or numeric format.

method

estimation algorithm, in string format. Valid values are 'duration' or 'cohort'.

interval

the length of the transition interval under consideration, in years. The default value is 1, i.e., 1-year transition probabilities are estimated.

snapshots

integer indicating the number of credit-rating snapshots per year to be considered for the estimation. Valid values are 1, 4, or 12. The default value is 1, i.e., one snapshot per year. This parameter is only used in the 'cohort' algorithm.

defind

Default Indicator

depVar

dependent variable, as a string.

indVars

list containing the independent variables.

ratingCat

list containing the unique rating caetgories

pct

percent of data used in training dataset.

tuning

perform tuning. If tuning='TRUE' tuning is perform. If tuning='FALSE' tuning is not performed

kernelType

the kernel used in training and predicting (see Package e1071 for more detail)

cost

cost of constraints violation (default: 1) it is the 'C' constant of the regularization term in the Lagrange formulation.

cost.weights

vector containing tuning parameters for cost

gamma

parameter needed for all kernels except linear (default: 1/(data dimension))

gamma.weights

vector containing tuning parameters for gamma

Value

The output consists of a forecasted transition matrix using SVM.

Author(s)

Abdoulaye (Ab) N'Diaye

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
## Not run: 
library(dplyr)
library(plyr)
library(Matrix)
library(tictoc)



for (i in c(24, 25, 26)) {
 print(paste("RUN-",i,sep=""))
 data <- data
 
 histData <- histData.normz
 
 
 predData_svm2 <- predData_svm_Baseline
 predData_svm2 <- subset(
   predData_svm2,
   X == i,
   select = c(Market.Volatility.Index..Level..normz

   )
 )
 
 indVars   = c("Market.Volatility.Index..Level..normz"

 )
 
 
 startDate = "1991-08-16"
 endDate   = "2007-08-16"
 
 depVar <- c("end_rating")
 
 pct <- 1
 wgt <-  "mCount"
 ratingCat <- c("A", "B", "C", "D", "E", "F", "G")
 defind    <- "G"
 lstCategoricalVars <- c("end_rating")
 tuning <- "FALSE"
 cost <- 0.01
 gamma <- 0.01
 cost.weights <-  c(0.01, 0.05, 0.1, 0.25, 10, 50, 100)
 gamma.weights <- c(0.01, 0.05, 0.1, 0.25, 10, 50, 100)
 kernelType <- "sigmoid"
 method    = "cohort"
 snapshots = 1
 interval  = 1
 
 
 svm_TM <-
   transForecast_svm(
     data,
     histData,
     predData_svm2,
     startDate,
     endDate,
     method,
     interval,
     snapshots,
     defind,
     depVar,
     indVars,
     ratingCat,
     pct,
     tuning,
     kernelType,
     cost,
     cost.weights,
     gamma,
     gamma.weights
   )
 print(svm_TM)
 
}

## End(Not run)

RTransProb documentation built on May 2, 2019, 6:49 a.m.