Main Content

predict

Predict loss given default

Description

example

LGD= predict(lgdModel,data)computes the loss given default (LGD).

When using aRegressionmodel, thepredictfunction operates on the underlying compact statistical model and then transforms the predicted values back to the LGD scale.

When using aTobitmodel, thepredictfunction operates on the underlyingTobitregression model and returns the unconditional expected value of the response, given the predictor values.

Examples

collapse all

This example shows how to usefitLGDModelto fit data with aRegressionmodel and then predict the loss given default (LGD) values.

Load Data

Load the loss given default data.

loadLGDData.mathead(data)
ans=8×4 tableLTV Age Type LGD _______ _______ ___________ _________ 0.89101 0.39716 residential 0.032659 0.70176 2.0939 residential 0.43564 0.72078 2.7948 residential 0.0064766 0.37013 1.237 residential 0.007947 0.36492 2.5818 residential 0 0.796 1.5957 residential 0.14572 0.60203 1.1599 residential 0.025688 0.92005 0.50253 investment 0.063182

Partition Data

Separate the data into training and test partitions.

rng('default');% for reproducibilityNumObs = height(data); c = cvpartition(NumObs,'HoldOut',0.4); TrainingInd = training(c); TestInd = test(c);

CreateRegressionLGD Model

UsefitLGDModelto create aRegressionmodel using training data.

lgdModel = fitLGDModel(data(TrainingInd,:),'regression'); disp(lgdModel)
Regression with properties: ResponseTransform: "logit" BoundaryTolerance: 1.0000e-05 ModelID: "Regression" Description: "" UnderlyingModel: [1x1 classreg.regr.CompactLinearModel] PredictorVars: ["LTV" "Age" "Type"] ResponseVar: "LGD"

Display the underlying model.

disp(lgdModel.UnderlyingModel)
Compact linear regression model: LGD_logit ~ 1 + LTV + Age + Type Estimated Coefficients: Estimate SE tStat pValue ________ ________ _______ __________ (Intercept) -4.7549 0.36041 -13.193 3.0997e-38 LTV 2.8565 0.41777 6.8377 1.0531e-11 Age -1.5397 0.085716 -17.963 3.3172e-67 Type_investment 1.4358 0.2475 5.8012 7.587e-09 Number of observations: 2093, Error degrees of freedom: 2089 Root Mean Squared Error: 4.24 R-squared: 0.206, Adjusted R-Squared: 0.205 F-statistic vs. constant model: 181, p-value = 2.42e-104

Predict LGD on Test Data

Usepredictto predict the LGD for the test data set.

predictedLGD = predict(lgdModel,data(TestInd,:))
predictedLGD =1394×10.0009 0.0037 0.1877 0.0011 0.0112 0.0420 0.0529 0.0000 0.0090 0.0239 ⋮

You can analyze and validate these predictions usingmodelDiscriminationandmodelAccuracy.

This example shows how to usefitLGDModelto fit data with aTobitmodel and then predict the loss given default (LGD) values.

Load Data

Load the loss given default data.

loadLGDData.mathead(data)
ans=8×4 tableLTV Age Type LGD _______ _______ ___________ _________ 0.89101 0.39716 residential 0.032659 0.70176 2.0939 residential 0.43564 0.72078 2.7948 residential 0.0064766 0.37013 1.237 residential 0.007947 0.36492 2.5818 residential 0 0.796 1.5957 residential 0.14572 0.60203 1.1599 residential 0.025688 0.92005 0.50253 investment 0.063182

Partition Data

Separate the data into training and test partitions.

rng('default');% for reproducibilityNumObs = height(data); c = cvpartition(NumObs,'HoldOut',0.4); TrainingInd = training(c); TestInd = test(c);

CreateTobitLGD Model

UsefitLGDModelto create aTobitmodel using training data.

lgdModel = fitLGDModel(data(TrainingInd,:),'tobit'); disp(lgdModel)
Tobit with properties: CensoringSide: "both" LeftLimit: 0 RightLimit: 1 ModelID: "Tobit" Description: "" UnderlyingModel: [1x1 risk.internal.credit.TobitModel] PredictorVars: ["LTV" "Age" "Type"] ResponseVar: "LGD"

Display the underlying model.

disp(lgdModel.UnderlyingModel)
Tobit regression model: LGD = max(0,min(Y*,1)) Y* ~ 1 + LTV + Age + Type Estimated coefficients: Estimate SE tStat pValue _________ _________ _______ __________ (Intercept) 0.058257 0.027276 2.1358 0.032809 LTV 0.20126 0.031373 6.415 1.7363e-10 Age -0.095407 0.0072543 -13.152 0 Type_investment 0.10208 0.018054 5.6542 1.7802e-08 (Sigma) 0.29288 0.005704 51.346 0 Number of observations: 2093 Number of left-censored observations: 547 Number of uncensored observations: 1521 Number of right-censored observations: 25 Log-likelihood: -698.383

Predict LGD on Test Data

Usepredictto predict the LGD for the test data set.

predictedLGD = predict(lgdModel,data(TestInd,:))
predictedLGD =1394×10.0879 0.1243 0.3204 0.0934 0.1672 0.2238 0.2370 0.0102 0.1592 0.1989 ⋮

You can analyze and validate these predictions usingmodelDiscriminationandmodelAccuracy.

Input Arguments

collapse all

鉴于损失default model, specified as a previously createdRegressionorTobitobject usingfitLGDModel.

Data Types:object

Data, specified as aNumRows-by-NumCols表和预测响应值。的变化able names and data types must be consistent with the underlying model.

Data Types:table

Output Arguments

collapse all

鉴于损失default values, returned as aNumRows-by-1numeric vector.

More About

collapse all

Prediction with LGD Models

Use a Regression or Tobit model to predict LGD.

RegressionLGD models first predict on the transformed space using the underlying linear regression model, and then apply the inverse transformation to return predictions on the LGD scale. For more information on the supported transformations and their inverses, seeLoss Given Default Regression Models.

TobitLGD models return the unconditional expected value of the response, given the predictor values. For more information, seeLoss Given Default Tobit Models.

References

[1] Baesens, Bart, Daniel Roesch, and Harald Scheule.Credit Risk Analytics: Measurement Techniques, Applications, and Examples in SAS.Wiley, 2016.

[2] Bellini, Tiziano.IFRS 9 and CECL Credit Risk Modelling and Validation: A Practical Guide with Examples Worked in R and SAS.San Diego, CA: Elsevier, 2019.

Introduced in R2021a