# Linear and Logistic Regression for Analysts

> Using regression to quantify relationships, control for other factors, and interpret coefficients honestly. Free notes, key concepts, resources and a mini...

Canonical: https://www.internhack.in/roadmaps/tracks/data-analyst/regression-basics
Last updated: 2026-11-28

Using regression to quantify relationships, control for other factors, and interpret coefficients honestly.

Intermediate · about 6 hours · difficulty 3/5

Learn first: [Hypothesis Testing and p-values](https://www.internhack.in/roadmaps/tracks/data-analyst/hypothesis-testing), [Correlation, Causation and Confounding](https://www.internhack.in/roadmaps/tracks/data-analyst/correlation-causation)

Regression fits a line (or surface) through data to describe how an outcome changes with one or more inputs. For analysts it is primarily an explanation tool, not a black-box predictor.

### Linear regression

- Models a numeric outcome: price, revenue, time spent.
- Each **coefficient** is the expected change in the outcome for a one-unit change in that input, holding the others constant.
- **R-squared** says how much variation is explained; low R-squared is normal for human behaviour and does not make a model useless.
- Check **residual plots** for patterns that suggest a missing variable or non-linear shape.

### Logistic regression

Models a yes/no outcome such as churn or conversion. Coefficients are in log-odds; exponentiate them to get odds ratios, which are easier to explain.

### Practical tips

- Encode categories as dummy variables and remember one level is the baseline.
- Log-transform skewed variables like income or revenue.
- Watch for **multicollinearity**: highly correlated inputs make individual coefficients unstable.
- Report confidence intervals on coefficients, not just point estimates.

### Tools

Excel's Analysis ToolPak and LINEST work for small cases. In Python, **statsmodels** gives readable summary tables; **scikit-learn** focuses on prediction.

**Pitfall:** interpreting a coefficient as causal just because other variables were "controlled for". Move on when you can fit a multiple regression and explain two coefficients in plain English with their uncertainty.

## Key concepts

- **Simple and multiple linear regression**
- **Interpreting coefficients**
- **R-squared and residuals**
- **Dummy variables**
- **Logistic regression and odds ratios**
- **Log transforms**
- **Multicollinearity**

## Mini project

Fit a multiple regression on the Kaggle House Prices (Ames Housing) dataset explaining sale price with size, quality and neighbourhood, and write a short memo interpreting three coefficients.

## Check yourself

What does it mean when a coefficient's confidence interval includes zero?

## Free resources

- [statsmodels documentation](https://www.statsmodels.org/stable/index.html) (statsmodels)
- [OpenIntro Statistics](https://www.openintro.org/book/os/) (OpenIntro)
- [Statistics and probability](https://www.khanacademy.org/math/statistics-probability) (Khan Academy)

Previous: [Correlation, Causation and Confounding](https://www.internhack.in/roadmaps/tracks/data-analyst/correlation-causation) · Next: [A/B Testing and Experiment Design](https://www.internhack.in/roadmaps/tracks/data-analyst/ab-testing)

## More in Statistical Thinking for Decisions

- [Descriptive Statistics](https://www.internhack.in/roadmaps/tracks/data-analyst/descriptive-statistics)
- [Probability and Distributions](https://www.internhack.in/roadmaps/tracks/data-analyst/probability-distributions)
- [Sampling, Bias and Data Collection](https://www.internhack.in/roadmaps/tracks/data-analyst/sampling-and-bias)
- [Estimation and Confidence Intervals](https://www.internhack.in/roadmaps/tracks/data-analyst/confidence-intervals)
- [Hypothesis Testing and p-values](https://www.internhack.in/roadmaps/tracks/data-analyst/hypothesis-testing)
- [Correlation, Causation and Confounding](https://www.internhack.in/roadmaps/tracks/data-analyst/correlation-causation)
- [Linear and Logistic Regression for Analysts](https://www.internhack.in/roadmaps/tracks/data-analyst/regression-basics)
- [A/B Testing and Experiment Design](https://www.internhack.in/roadmaps/tracks/data-analyst/ab-testing)

## Related

- [Roadmaps](https://www.internhack.in/roadmaps)
- [Data Analyst Roadmap](https://www.internhack.in/roadmaps/tracks/data-analyst)
