Learn R Programming

RTransProb (version 0.1.0)

transForecast_svm: Forecast - using Support Vector Machines

Description

This model implements a forecasting method using Support Vector Machines.

Usage

transForecast_svm(transData, histData, predData_svm, startDate, endDate,
                    depVar, indVars,  ratingCat, pct, tuning, kernelType, cost,
                    cost.weights, gamma, gamma.weights)

Arguments

transData

aggregate transition matrix data.

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.

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.

Examples

Run this code
# NOT RUN {
startDate <- as.Date("1990-01-01")
endDate <- as.Date("2005-01-01")
depVar <- c("end_rating")
indVars <-c("Macro1", "Financial1","Industry1")
pct <- 0.8
wgt <-  "mCount"
ratingCat <- c("A","B", "C", "D", "E", "F", "G", "N")
lstCategoricalVars <- c("end_rating")
tuning <- "TRUE"
cost <- 100
gamma <- .1
cost.weights <- c(0.1, 10, 100)
gamma.weights <- c(0.01, 0.25, 0.5, 1)
kernelType <- "radial"

# }
# NOT RUN {
transData <- expandTransData(df,wgt)
# }
# NOT RUN {
svm_T<-transForecast_svm(transData, histData, predData_svm,  startDate, endDate,
       depVar,indVars,  ratingCat, pct, tuning, kernelType,cost, cost.weights,
       gamma, gamma.weights)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab