Week 6 Notes
Week 6 Notes
• Thresholding
• Confusion/classification Matrix
• Receiver operator characteristic (ROC) curve
• Parameter interpretation
• Summary and concluding remarks
Background and Motivation
Limited Dependent Variable/Qualitative
Response Regression
Discrete choice variables, limited dependent variables, or qualitative response
variables are not suitable for modeling through linear regression models
Consider the following questions
• Why do firms choose to list their stocks on NSE vs. BSE?
• Why do some stocks pay dividends and others do not?
• What factors affect large corporate borrowers to default?
• What factors affect choices of internal vs. external financing?
Limited Dependent Variable/Qualitative
Response Regression
Credit default scoring (classification problem)
Linear Probability Model (LPM)
Linear Probability Model (LPM)
Nonfulfillment of 0 ≤ E(Yi | X) ≤ 1
• 𝑌𝑖 = −0.3 + 0.012𝑋𝑖 ; where 𝑋𝑖 is in million
dollars
• For every $1 million increase in size, the
probability that the firm will pay dividend
increases by 1.2%
• However, for X < $25 million and X > $88
million, the probabilities are less than 0 and
more than 1
Issues with LPM
Nonfulfillment of 0 ≤ E(Yi | X) ≤ 1
• What to do: set all negative as 0 and all
those greater than 1 as 1?
• Implausible to suggest that small firms
will never pay dividend and large firms
will always pay dividends
Issues with LPM
What value should we select for “t”? What kind of error do you
prefer?
• Given a t value, one can make two types of errors: (1) predict
default, but the actual outcome is non-default: false positive; and
(2) predict non-default, but the actual outcome is default: false
negative
• A large threshold (e.g., t = 0.8) will have a very small probability of
predicting defaulters and, at the same time, a high probability of
predicting cases as non-defaulters
Thresholding
What value should we select for “t”? What kind of error do you
prefer?
• A small threshold (e.g., t = 0.1) will have a very large probability of
predicting defaulters and, at the same time, a small probability of
predicting cases as non-defaulters
• An aggressive bank would like to have high t values to increase
the possibility of converting a loan
Thresholding
What value should we select for “t”? What kind of error do you
prefer?
• A more conservative bank may choose a very low t value to select
those loan applications with a very low probability of default
• In the absence of any threshold, t = 0.5 is the correct value to pick
Classification Matrix
Selecting a Threshold:
Confusion/Classification Matrix
Predicted = 0 (Non-Default) Predicted = 1 (Default)
Actual = 0 True Negatives (TN) False Positives (FP)
Actual = 1 False Negatives (FN) True Positives (TP)
Let us compute two outcome measures to determine what kind of errors we are
making
TP
• Sensitivity = = TP rate
TP+FN
TN
• Specificity = = TN rate
TN+FP
Selecting a Threshold:
Confusion/Classification Matrix
Let us compute two outcome measures to determine what kind of errors we are
making
TP
• Sensitivity = = TP rate
TP+FN
TN
• Specificity = = TN rate
TN+FP
• A model with higher t will have lower sensitivity and higher specificity
• A model with lower t will have higher sensitivity and lower specificity
Selecting a Threshold:
Confusion/Classification Matrix
(TN+TP)
• Overall accuracy = , where 𝑁 = number of observations
𝑁
(FP+FN)
• Overall error rate =
𝑁
FN
• False negative error rate =
(TP+FN)
FP
• False positive error rate =
(TN+FP)
Receiver Operating Characteristic
(ROC) Curve
Receiver Operator Characteristic (ROC) Curve
Conventional 𝑅2 and adj. −𝑅2 measures do not work well with these
models
MLE aims to maximize the log-likelihood function (LLF) and do not
minimize RSS
(1) % of 𝑦𝑖 values correctly predicted
(2) % of 𝑦𝑖 = 1 values correctly predicted + % of 𝑦𝑖 = 0 values
correctly predicted
Goodness-of-Fit Measures
So, we are given the data for stock market price for ABC company, along with Nifty and Sensex
(market indices). We are also given the data of dividend announcement and a sentiment index.
Dividend
Date Price ABC Sensex Sentiment Nifty
Announced
03-01-2007 718.15 0.079925 0.073772 0 0.048936 0.095816
04-01-2007 712.9 –0.00731 0.021562 0 –0.05504 0.009706
05-01-2007 730 0.023987 –0.02441 0 0.019135 –0.03221
06-01-2007 788.35 0.079932 0.012046 0 0.080355 0.011205
07-01-2007 851.4 0.079977 –0.0013 0 0.094038 –0.0004
10-01-2007 919.5 0.079986 0.019191 1 0.015229 0.030168
11-01-2007 880 –0.04296 –0.04025 0 –0.07217 –0.04966
12-01-2007 893.75 0.015625 0.036799 0 0.01396 0.020999
13-01-2007 875 –0.02098 –0.00845 0 0.057518 –0.01164
14-01-2007 891 0.018286 0.004858 1 0.008828 0.020714
17-01-2007 819.75 –0.07997 –0.01228 0 –0.12395 –0.00962
…… …… …… …… …… …… ……
…… …… …… …… …… …… ……
Case Study: Stock Price Prediction
• Sensex and Nifty are the two main stock indices used in India
• They are benchmark Indian stock market indices that represent
the weighted average of the largest Indian companies
• So, Sensex represents average of 30 largest and most actively
traded Indian companies
• Similarly, Nifty represents a weighted average of 50 largest Indian
companies
Summary
• In this video, we will create the test and train sample datasets
• Then we will examine the distribution of our binary response
variable in 1’s and 0’s
Summary
• We computed the correlation across the fitted values for the three
classification algorithms (linear, logit, and probit)
• The correlations appear to be very high
• Next, we visualized the performance of the algorithms on
parameters of accuracy, sensitivity, and specificity for the three
threshold values of 0.4, 0.6, and 0.8
• While the performance of these algorithms appear to be close,
logit model appears to offer the best fit, followed by the probit,
and then the linear model
Receiver Operating Characteristic
(ROC) Curve
ROC Curve
•
Creating Performance Objects
Creating Performance Objects