transForecast_mnl: Forecast - using Multinomial Logistic Regression

Description Usage Arguments Details Value Author(s) Examples

Description

This model implements a forecasting method using multinomial logistic regression (also known as Softmax Regression in machine learning parlance).

Usage

1
2
transForecast_mnl(data, histData, predData_mnl, startDate, endDate, method, 
                         interval,snapshots, defind,ref, depVar, indVars, ratingCat, wgt)

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_mnl

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

ref

base or reference category for the dependent variable.

depVar

dependent variable, as a string.

indVars

list containing the independent variables

ratingCat

list containing the unique rating categories

wgt

weights

Details

Multinomial logistic regression is a simple extension of binary logistic regression that allows for more than two categories of the dependent or outcome variable. Whereas, a binary logistic regression model compares one dichotomy, the multinomial logistic regression model compares a number of dichotomies. Like binary logistic regression, multinomial logistic regression uses maximum likelihood estimation to evaluate the probability of categorical membership.

Assume there are 1,2,3 ...K groups in a dataset, and group 1 is the one chosen as the reference category. The logistic model states that the probability of falling into group j given the set of predictor values x is given by the general expression

P(y=k|\emph{X}) = \frac{exp(\emph{X}β_{k})}{1+∑_{j=2}^{N}exp(\emph{X}β_{j})}

Value

The output consists of a forecasted transition matrix.

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
78
79
80
## Not run: 

library(dplyr)
library(plyr)
library(Matrix)




for (i in c(24, 25, 26)) {
  data <- data
  
  attach(data)
  data2 <- data[order(ID, Date),] 
  detach(data)
  
  data <- data2
  rm(data2)
  
  
  histData <- histData
  
  
  predData_mnl2 <- predData_mnl_Baseline
  predData_mnl2 <- subset(
    predData_mnl,
    X == i,
    select = c(Market.Volatility.Index..Level.,
               D_B,
               D_C,
               D_D,
               D_E,
               D_F,
               D_G
    )
  )
  
  indVars   = c("Market.Volatility.Index..Level."

  )
  
  
  startDate = "1991-08-16"
  endDate   = "2007-08-16"
  method    = "cohort"
  snapshots = 1
  interval  = 1
  ref       = 'A'
  depVar    = c("end_rating")
  ratingCat = c("A", "B", "C", "D", "E", "F", "G", "N")
  defind    = "N"
  wgt       = "mCount"
  
  
  
  transForecast_mnl_out <-
    transForecast_mnl(
      data,
      histData,
      predData_mnl2,
      startDate,
      endDate,
      method,
      interval,
      snapshots,
      defind,
      ref,
      depVar,
      indVars,
      ratingCat,
      wgt
    )
  output <- transForecast_mnl_out$mnl_Predict
  print(output)
  
}


## End(Not run)
  

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