Can OLS be used for logistic regression?

Can OLS be used for logistic regression?

In short: Yes, if your response variable is continuous, even if one of the X variables is binary, you can use OLS. Yes, you should only use logistic regression if your response variable is binary.

When should I use OLS?

In data analysis, we use OLS for estimating the unknown parameters in a linear regression model. The goal is minimizing the differences between the collected observations in some arbitrary dataset and the responses predicted by the linear approximation of the data.

When to use OLS with a binary variable?

If you’re trying to optimize squared error, then even with this binary variable: OLS is exactly what you need. If, on the other hand, you’re interested in minimizing log loss or hoping to get a calibrated probability – then you better use logistic regression. OLS with a threshold is a real classifier.

Is the OLS method a good classifier?

OLS with a threshold is a real classifier. It may not explicitly optimize a traditional classification metric, but you can definitely *evaluate* it with a traditional classification metric; and if you’re happy with the results, then … great! For classification problems, sometimes OLS with a threshold is good.

How is logistic regression used in binary classification?

Logistic Regression on the other hand is used to ascertain the probability of an event, this event is captured in binary format, i.e. 0 or 1. Just so you know, with logistic regression, multi-class classification is possible, not just binary. But logistic regression is mostly used in binary classification.

How to implement ordinary least squares ( OLS ) method?

OLS method The sm.OLS method takes two array-like objects a and b as input. a is generally a Pandas dataframe or a NumPy array. The shape of a is o*c, where o is the number of observations and c is the number of columns. b is generally a Pandas series of length o or a one dimensional NumPy array.