辅导CFRM 542程序、R编程讲解、辅导program程序语言
- 首页 >> Java编程 CFRM 542 Credit Risk Management Fall 2020 Assignment 2
CFRM 542 Assignment #2
Due: Wednesday, October 28th at 11:59 PM Pacific time
Instructions: Complete problems 1-3 below. Document your results in a single electronic file, such as a
Microsoft Word document, and show all of your work. For problem 1 you may wish to submit
handwritten results for (a)-(d), in which case you can scan and include this in the electronic document as
an image. Submit your completed assignment to the drop box on the course website. You may discuss
this assignment with your classmates and TA but the work you submit, including your code and results
from R, must be your own.
1. Maximum Likelihood Estimation. Consider a set of data with N total observations, of which D
contain the event we are trying to model (e.g. in our Coronary Heart Disease example, N is 100
and D is the number of patients with CHD).
a. Write down a logistic probability function 𝜋 to model this data using only an intercept
term – i.e., there is no independent variable.
b. Write down the likelihood function and the log likelihood function based on this
intercept-only model.
c. Write down the derivative of the log likelihood with respect to the unknown intercept
parameter.
d. The log likelihood is maximized in this example when the derivative is equal to zero. Use
this to show that the maximum likelihood probability 𝜋 =
𝐷
𝑁
2. Logistic Regression Analysis 2.
a. Write a function in R to calculate the K-S statistic, as defined in the lecture 4. Your
function should take as input two vectors. The first vector is the (not sorted) list of
probability estimates and the second vector is the vector of corresponding actual
outcomes (i.e., a vector of 1s and 0s). Submit the R code defining your function.
b. Use your function and the CHD data from class. What is the KS of the best fit logistic
regression between age and CHD? Show the R commands used to calculate this.
c. Using the Lending Club data from assignment 1, create and submit a plot of log odds of
default vs. revolving line utilization using 20 bins. What do you observe?
d. Make a best fit logistic regression between default and revolving line utilization. In your
model, do something to account for higher default risk at the lowest utilization level and
model the relationship between utilization and log odds of default as piecewise-linear in
two parts. Create and submit a plot of model vs. actual log-odds as a function of
utilization. Submit your script and the summary regression results from R.
CFRM 542 Credit Risk Management Fall 2020 Assignment 2
3. Working with credit transitions. Use the credit rating transition matrix from Lecture for this
problem.
a. What is the probability distribution of credit states for a AAA credit after 3 years? What
is the probability distribution after 5 years?
b. Make a table showing the probability of default over 1, 2, 3, and 5 years for each of the
starting 7 credit grades (AAA through CCC)
c. As the time horizon over which you project the credit transitions increases, what is the
limiting probability distribution for each starting credit grade? i.e., as the number of
years increases to infinity, to what does the probability distribution of credit states
converge? After you have figured out the limiting behavior (you may experiment to
form your hypothesis) write down an argument for why this must be the case. A few
well-written sentences explaining the dynamics and the limiting behavior will earn full
credit. If you remember enough linear algebra, you can prove this limiting behavior
mathematically.
CFRM 542 Assignment #2
Due: Wednesday, October 28th at 11:59 PM Pacific time
Instructions: Complete problems 1-3 below. Document your results in a single electronic file, such as a
Microsoft Word document, and show all of your work. For problem 1 you may wish to submit
handwritten results for (a)-(d), in which case you can scan and include this in the electronic document as
an image. Submit your completed assignment to the drop box on the course website. You may discuss
this assignment with your classmates and TA but the work you submit, including your code and results
from R, must be your own.
1. Maximum Likelihood Estimation. Consider a set of data with N total observations, of which D
contain the event we are trying to model (e.g. in our Coronary Heart Disease example, N is 100
and D is the number of patients with CHD).
a. Write down a logistic probability function 𝜋 to model this data using only an intercept
term – i.e., there is no independent variable.
b. Write down the likelihood function and the log likelihood function based on this
intercept-only model.
c. Write down the derivative of the log likelihood with respect to the unknown intercept
parameter.
d. The log likelihood is maximized in this example when the derivative is equal to zero. Use
this to show that the maximum likelihood probability 𝜋 =
𝐷
𝑁
2. Logistic Regression Analysis 2.
a. Write a function in R to calculate the K-S statistic, as defined in the lecture 4. Your
function should take as input two vectors. The first vector is the (not sorted) list of
probability estimates and the second vector is the vector of corresponding actual
outcomes (i.e., a vector of 1s and 0s). Submit the R code defining your function.
b. Use your function and the CHD data from class. What is the KS of the best fit logistic
regression between age and CHD? Show the R commands used to calculate this.
c. Using the Lending Club data from assignment 1, create and submit a plot of log odds of
default vs. revolving line utilization using 20 bins. What do you observe?
d. Make a best fit logistic regression between default and revolving line utilization. In your
model, do something to account for higher default risk at the lowest utilization level and
model the relationship between utilization and log odds of default as piecewise-linear in
two parts. Create and submit a plot of model vs. actual log-odds as a function of
utilization. Submit your script and the summary regression results from R.
CFRM 542 Credit Risk Management Fall 2020 Assignment 2
3. Working with credit transitions. Use the credit rating transition matrix from Lecture for this
problem.
a. What is the probability distribution of credit states for a AAA credit after 3 years? What
is the probability distribution after 5 years?
b. Make a table showing the probability of default over 1, 2, 3, and 5 years for each of the
starting 7 credit grades (AAA through CCC)
c. As the time horizon over which you project the credit transitions increases, what is the
limiting probability distribution for each starting credit grade? i.e., as the number of
years increases to infinity, to what does the probability distribution of credit states
converge? After you have figured out the limiting behavior (you may experiment to
form your hypothesis) write down an argument for why this must be the case. A few
well-written sentences explaining the dynamics and the limiting behavior will earn full
credit. If you remember enough linear algebra, you can prove this limiting behavior
mathematically.