## What is a Logistic Regression?

With the logistic regression model, we describe the relationship between predictors that can be continuous, binary, categorical, and categorical dependent variables. For example, the dependent variable can be binary, and we predict whether something will happen or not. We estimate the probabilities of belonging to each category for a given set of predictors. Binary logistic regression implies that we have one dependent binary variable that takes the values 1 or 0 (e.g. 1 – yes, 0 – no).

**What is binary logistic regression used for?**

Logistic Regression is a classification algorithm that is used when we want to predict a categorical variable (Yes/No, Pass/Fail) based on a set of the independent variable(s). In the Logistic Regression model, the log of odds of the dependent variable is modeled as a linear combination of the independent variables.

### An Example Of Logistic Regression Analysis

For example, a researcher wants to examine whether levels of stress, anxiety, and happiness predict success in an English language exam. So, we have one dependent variable – passed English language exam (1 – yes, 0 – no) and three independent variables – level of stress, anxiety, and happiness.

**What are the use of null and alternative hypothesis for the Logistic Regression?**

Therefore, we test the following hypotheses:

* Null hypothesis: *Levels of stress, anxiety, and happiness do not significantly predict the probability of passing the English language exam.

* Alternative hypothesis: *Level of stress, anxiety, and happiness significantly predict the probability of passing the English language exam.

## R function to Compute Logistic Regression

The code to run a Logistic Regression using R is as follows:

glm (DV~ IV1 +IV2,…+IVx, family=binomial, data = dataframe)

**DV**: dependent variable (two-group categorical variable)

**IV**: Independent variables