LoslegenKostenlos loslegen

In-sample fit restricted model

You calculated the accuracy for logitModelFull. It's very important to do that with all your model candidates.

Therefore,logitModelNew is specified and lives in your environment.

When comparing the values of the different models with each other: In case different models have the same accuracy values, always choose the model with less explanatory variables.

Diese Übung ist Teil des Kurses

Machine Learning for Marketing Analytics in R

Kurs anzeigen

Anleitung zur Übung

  • Do the same steps as in the previous exercise for the new model.

  • Use predict() to receive a probability for each customer to default his payment.

  • Then calculate a confusion matrix with the same threshold of 0.5 for classification. Note that SDMTools cannot be downloaded from CRAN anymore. Install it instead via remotes::install_version("SDMTools", "1.1-221.2").

  • Calculate the accuracy of the restricted model and compare it to the accuracy of the full model. You will continue your analysis only with the superior model.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Calculate the accuracy for 'logitModelNew'
# Make prediction
defaultData$predNew <- predict(logitModelNew, type = ___, na.action = ___)

# Construct the in-sample confusion matrix
confMatrixModelNew <- confusion.matrix(defaultData$___,defaultData$___, threshold = ___)
confMatrixModelNew

# Calculate the accuracy...
accuracyNew <- sum(diag(___)) / ___(___)
accuracyNew

# and compare it to the full model's accuracy
accuracyFull
Code bearbeiten und ausführen