Binary or Continuous? A Comparative Analysis of Logistic and Linear Regression

btd
3 min readNov 16, 2023

Logistic regression and linear regression are both techniques used for modeling relationships between variables, but they are suited for different types of problems. Here are the key differences between logistic regression and linear regression:

1. Type of Dependent Variable:

Linear Regression:

  • Linear regression is used when the dependent variable is continuous and follows a normal distribution.
  • Examples include predicting house prices, temperature, or stock prices.

Logistic Regression:

  • Logistic regression is used when the dependent variable is binary (two classes: 0 or 1) or categorical.
  • Examples include predicting whether a student passes or fails an exam, whether a customer buys a product or not.

2. Output Type:

Linear Regression:

  • The output of linear regression is a continuous value. It predicts a quantity that can range from negative to positive infinity.

Logistic Regression:

  • The output of logistic regression is a probability, typically between 0 and 1. The probability is then transformed into a binary outcome (0 or 1) using a threshold (e.g., 0.5).

3. Model Equation:

Linear Regression:

  • The model equation for linear regression is of the form Y=β0​+β1​X1​+β2​X2​+…+βnXn​+ϵ, where Y is the dependent variable, X1​,X2​,…,Xn​ are the independent variables, and ϵ is the error term.

Logistic Regression:

  • The model equation for logistic regression is logit(p)=β0​+β1​X1​+β2​X2​+…+βnXn​, where p is the probability of the event occurring (1 in binary logistic regression), and logit(p) is the natural logarithm of the odds of the event occurring.

4. Assumptions:

Linear Regression:

  • Assumes a linear relationship between the independent and dependent variables.

--

--