## Instructions

The assignment has to be done in Python and Jupyter Notebook

Please save the larger dcr.csv and dcr.py (please use the same py file as for the class) in a separate assignment folder. Please run the dcr module prior to starting

Provide the Python code as a Jupyter Notebook file with all answers.

Copy your written text answers (markdown) into a word document. Delete the questions and code.

Upload the two documents Jupyter Notebook file and word document. There is no size limit for the Jupyter Notebook document and a page limit of 10 pages applied to the word document. You may print charts as a panel to conserve space and be concise (e.g., 2*2 for four or 3*3 for nine)

## Problems

Data-description

Perform a TVA (time vintage ad age) analysis for the following three features ("feature set" throughoutinstructions, do not add or remove features unless instructed): LTV_time, cep_time (cumulative excess payments, please self-calculate) and FICO_orig_time (nine charts in total). Interpret your findings

. Form a number of classes using quantiles or self-defined boundaries for the feature set and visualize the default rates per class (three charts in total). Choose between 2 and 10 classes and tell a story for the link between feature and default. You may consider using the cut() or qcut() methods. Interpret your findings

PD modelling

Estimate a credit risk model for mortgage default probabilities (PD) (you may choose a logit or a probit model). Include the feature set. Compute the estimated PD for all mortgage loans and periods. Plot and compare the average probability of default and default rate over time and over each feature (four charts in total). Provide your code, output for the model and interpret the output.

Estimate the PD model again by including a non-linear transformation of the features set that results in a better model accuracy. Non-linear transformations may include splines, polynomial terms or other transformations and may result in the same or a higher number of variables (chapter 6 of textbook may help). Compute the estimated PD for all mortgage loans and periods. Plot and compare the average probability of default and default rate over time and over each feature (four charts in total). Provide your code, an output for the model, the plots and interpret the output.

Compare the accuracy of two models from sub-questions 2A and 2B. Present and explain your findings with regard to model accuracy?

LGD modelling

Estimate a linear regression model to predict LGD. Include the feature set. Plot and compare the average model implied and observed LGD over time and over each feature (four charts in total). Provide your code, output for the model and interpret the output.

Estimate a linear regression model to predict LGD. Include a non-linear transformation of the feature set (this may be different to question 2B). Plot and compare the average model implied and observed LGD over time and over each feature (four charts in total). Provide your code, output for the model and interpret the output.

Suggest two additional features that you think can explain for mortgage LGD. Explain the rationale (relation to LGD).

Bank capital allocation

Compute the Basel capital ratio for all mortgage loans and periods using the internal ratings based approach. Assume correlation at 15%. Consider two settings: Setting I: PDs should be inferred from the model of question 2A and LGDs should be inferred from the model of question 3A. Setting II: PDs should be inferred from the model of question 2B and LGDs should be inferred from the model of question 3B. You may set the exposure to default to one unit or use actual loan amounts. Plot the average capital ratio by time in one chart per setting (two charts in total). Provide your code, plots and analyse the output.

Loan pricing

What should be the appropriate interest rate charged for a borrower with the following features LTV_time=80, cep_time=0, FICO_orig_time=700. Include all your assumptions.

Bonus question

Draft a dashboard application for loan pricing: define inputs (feature names including user choices like radio buttons, drop-down lists, calculations and a single output chart. Think carefully what you want to show in chart on x-axis (variable of variation) and on y-axis (variable of interest)

Create a dashboard application using package JupyterDash. Include appropriate comments using hashtags

## Comments