Logistic Regression- R

0
124

Logistic Regression: Till now we have tried to understand theory behind logistic regression. In this section we would cover implementation of Logistic Regression in R i.e. commands and packages required for Logistic regression.

We will try to predict probability of default/Non-Default using Logistic Regression. In the following sections we would look into the basics commands and packages of R.

Step 1. Set up a working library. Setting up a working directory makes life very easy. We can refer to any file saved in working library without mentioning location again and again

LLR_1

Step 2: Import the data set into R-Studio using following commands.

LLR_2

Step 3. : Install the package required for Logistic regression. We would install “caTools” for Logistic regression.

LLR_3

Step4: Our data set has 5 variables but for analysis we would use just last three variables. So we would select last tree variable using following commands.

LLR_4

Step 5. Build Logistic Regression Model using following commands

LLR_5

Step 6. Predicting the regression output

LLR_6

Step 7. Creating a confusion matrix to evaluate the result

LLR_7

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here