Exercise

Logistic Regression

Construct a logistic regression predicting default based on parameters in the mortData data set.

Instructions

100 XP

Before you start building models, explore your workspace using ls(), and take a look at the variable mortData. Next, go ahead get the meta-data about the dataset, including the variables within it using rxGetInfo().

After you have taken a look at the data, use rxLogit() to construct a logistic regression to predict mortgage default data.

The structure of a call to rxLogit() is very similar to the structure of rxLinMod(). The syntax is:

rxLogit(formula, data, …)

  • formula - The model specification.
  • data - The dataset in which you would like to search for variables used in formula
  • … - Additional arguments.

Go ahead and use rxLogit in order to create a logistic regression object called logitModel, in which you predict default status from the varialbes corresponding to house age, year of the observation, credit card debt, credit score, and years employed. Use the F() function to make year a factor variable.

Make sure to use the summary function to look at the output.