Upper-undergraduate econometrics

Simple OLS Regression

An immediate native simulation for simple linear regression compares observed outcomes, the true conditional mean, and the fitted OLS line; the retained notebook adds sample and residual diagnostics.

Econometrics Regression Intermediate EasyEcon / Marimo Regression, identification, and simulated evidence
Focus

Fitted line, residuals, precision, and known truth

Adjust the true intercept, slope, noise, and sample size to relate realised estimates to fit, slope estimation error, and an approximate 95% slope interval.

Interactive diagram

Simple OLS

Drag a slider — every curve and number responds instantly.

Simple OLS: known truth and the fitted regression line Observed outcomes vary around a known linear conditional mean. The solid line shows that truth and the dashed line shows the OLS estimate from the active sample. 0 2 4 6 8 10 -1.6 1.9 5.4 8.9 12.4 15.9 Explanatory variable x Outcome y
Observed data True conditional mean (solid) OLS fitted line (dashed)

How to read this

Each dot is one observed pair of an explanatory variable x and outcome y. The solid line is the true conditional mean used to generate the data; the dashed line is the OLS estimate from the observations currently in the sample.

Move the true intercept or slope to change the underlying relationship. Noise spreads outcomes around that relationship, so the realised fitted line does not generally equal the truth even though OLS targets the average linear relationship.

Increase the sample size to append observations from the same deterministic latent bank. Compare the slope estimation error and the approximate interval: more data usually improves precision, but a single realised estimate need not move monotonically towards the truth.

Econometrics and causal inference

Step 1 of 5

What to explore

Change parameters and watch the model adjust.

  • True intercept, true slope, noise scale, and sample size
  • The native diagram and full notebook use the same four controls but separate deterministic random draws

Core ideas

Interpret the mechanics before you chase the graphs.

  • OLS recovers the average linear relationship in the sample, not each noisy point.
  • More noise tends to weaken fit, while larger samples usually improve coefficient precision.
  • Residual plots are useful because they expose what the fitted line leaves unexplained.

Learning goals

What this model should help students internalize.

  • Interpret the slope and intercept in a simple linear regression with simulated data.
  • See how noise and sample size affect fit and coefficient precision.
  • Connect residual behaviour to the gap between the fitted line and the true data-generating process.

Prerequisites

Concepts to review before diving in.

  • Basic algebra and scatterplot reading
  • Comfort with the idea of a conditional mean relationship
Open the full interactive notebook (Python · loads on demand)

EasyEcon interactive

Simple OLS notebook

EasyEcon / Marimo

On phones, the full-screen view gives the cleanest notebook reading experience.

Open full screen

Deferred notebook load

Fitted line, residuals, precision, and known truth

Adjust the true intercept, slope, noise, and sample size to relate realised estimates to fit, slope estimation error, and an approximate 95% slope interval.

Open full screen
The EasyEcon Marimo/WASM bundle loads only when requested or when the panel scrolls near view on fast connections.

Next models to study

Keep moving through the track.