EconStatsCraft rigorous, plain-spoken econometrics
Econometrics that explains itself.
Regression, panel data, time series and the whole battery of tests. Every result is followed by a verdict you can defend.
Load a dataset to see it here.
EconStatsCraft › Instrumental variables (2SLS)
Two-stage least squares. Reports the first stage, the weak-instrument F, the Wu–Hausman endogeneity test and the Sargan over-identification test.
You want the effect of schooling on wages, but people who choose more schooling differ in unobserved ways. An instrument is a lever that pushes schooling around for reasons unrelated to those unobservables - proximity to a college, a birth date that changes compulsory-schooling exposure. Use ONLY the variation the lever creates, and the confounding is left behind with the variation you discarded.
Simultaneity (price and quantity determined together), omitted variables (ability affecting both schooling and wages), or measurement error in a regressor.
OLS solves E[x(y-x'\beta)]=0, which fails when E[xu]\ne 0. IV replaces it with the moment condition E[z(y-x'\beta)]=0, giving \hat{\beta}=(Z'X)^{-1}Z'y when instruments and regressors are equal in number. With more instruments, 2SLS projects X onto Z: \hat{\beta}=(\hat{X}'\hat{X})^{-1}\hat{X}'y with \hat{X}=P_Z X. Crucially the variance uses \hat{\sigma}^2(\hat{X}'\hat{X})^{-1} where \hat{\sigma}^2 comes from residuals computed with the ACTUAL X - which is exactly why running two OLS regressions by hand gives the wrong standard errors.
\hat{\boldsymbol{\beta}}_{\text{2SLS}}=(\hat{\mathbf{X}}^{\prime}\hat{\mathbf{X}})^{-1}\hat{\mathbf{X}}^{\prime}\mathbf{y},\qquad \hat{\mathbf{X}}=\mathbf{P}_{\mathbf{Z}}\mathbf{X}=\mathbf{Z}(\mathbf{Z}^{\prime}\mathbf{Z})^{-1}\mathbf{Z}^{\prime}\mathbf{X}
OLS puts the return to schooling at 0.2072; 2SLS, instrumenting with proximity to a college, puts it at 0.0924 (SE 0.0257). The first-stage F is 144.84 on (1, 896), far above the rule-of-thumb 10, and the Wu-Hausman test rejects exogeneity at F = 28.16. So OLS is more than twice the instrumented estimate - the direction omitted ability predicts, and a larger gap than most published applications find. The first stage is what makes the second stage readable: with a weak instrument the 2SLS estimate is biased towards OLS and its confidence interval is not to be trusted at all, which is why the F is reported before the coefficient rather than after it.
| If you see this | It means | Do this |
|---|---|---|
| First-stage F < 10 | Weak instruments | Find stronger ones, or report Anderson–Rubin confidence sets |
| 2SLS ≈ OLS and Wu–Hausman does not reject | Endogeneity may be minor | OLS is defensible and more efficient - but the test has low power |
| 2SLS enormous with huge SEs | Weak instrument dividing by nearly zero | Do not report it as a point estimate |
| Sargan rejects | At least one instrument violates exclusion | Drop the suspect one and re-test |
| Multiple endogenous regressors | Per-equation F is the wrong test | Use Cragg–Donald / Kleibergen–Paap with Stock–Yogo values |
| Instrument plausibly affects y directly | Exclusion fails | No statistic can fix this - argue it or abandon it |
RD is IV with the discontinuity as the instrument; DiD is a different strategy for the same identification problem.
Spatial autocorrelation · Spatial regression · Heckman selection · Difference-in-differences · Staggered difference-in-differences · Regression discontinuity · Matching & weighting · Oaxaca–Blinder decomposition
Line chart · Area chart · Bar chart · Stacked bar · Scatter plot · Bubble chart · Histogram · Box plot · Pie chart · Heat map · Rebased to 100 · Lorenz curve and Gini
World map · Bivariate map · Flow map · India - state map · India - district map
Descriptive statistics · Summary by group · Two-way table · Classical statistical tests
Multiple regression (OLS) · Logit / Probit · Tobit (censored) · Truncated regression · Multinomial logit · Ordered logit / probit · Quantile regression · Poisson / Negative binomial
Time-varying coefficients (Kalman) · Unit root tests · Correlogram (ACF / PACF) · ARIMA / SARIMA · Rolling-origin cross-validation · Theta method · Unobserved components · STL forecasting · Forecast combination · Markov regime switching · Change frequency (resample) · ARCH / GARCH volatility · Decompose & filter · Spectral analysis · Exponential smoothing · Forecast accuracy
Yield curve (Nelson–Siegel / Svensson) · Dynamic factor model · Dynamic regression (ARIMAX) · Structural VAR · VAR · Granger causality · Cointegration · VECM · ARDL & bounds test
Panel regression · Panel cointegration tests · Heterogeneous panel: Mean Group & PMG · Gravity model of trade · Dynamic panel GMM · Panel diagnostics · Panel unit-root tests
Principal components (PCA) · Factor analysis · Cluster analysis
Conjoint analysis · MaxDiff (best–worst scaling) · TURF - reach of a product line · Price sensitivity (Van Westendorp) · Market basket analysis · Perceptual map · Scale reliability (Cronbach’s alpha) · Key driver analysis
Spatial autocorrelation · Spatial regression · Heckman selection · Instrumental variables (2SLS) · Difference-in-differences · Staggered difference-in-differences · Regression discontinuity · Matching & weighting · Oaxaca–Blinder decomposition
Black–Scholes option pricing · Bond price, duration & convexity · Merton distance to default · EMI / home loan planner · CAPM / beta estimation · Multi-factor model · Portfolio optimization · Value at Risk & Expected Shortfall · Performance & drawdown · Time value of money & NPV/IRR · Equity valuation (DDM, FCF, residual income) · Cost of capital (WACC) · Binomial option pricing · Option strategies (payoff & profit) · Forwards, futures & swaps · Credit risk & Basel capital · Extreme value theory (tail risk)
Life table · Life annuity · Life insurance pricing · Chain ladder reserving · Buhlmann credibility · Survival analysis · Mortality graduation · Aggregate loss model · Ruin probability · Multi-state Markov model · Loss severity fitting
Monte Carlo experiment · F-test, Wald & Chow · Structural breaks & stability
Regression vs machine learning · Ridge / Lasso / Elastic Net · Random forest · Gradient boosting
EconStatsCraft rigorous, plain-spoken econometrics
Regression, panel data, time series and the whole battery of tests. Every result is followed by a verdict you can defend.
Load a dataset to see it here.
Pick the example closest to your question. You get a spreadsheet with the right columns and a few rows showing the expected format - replace the numbers with your own, then paste or upload it back.
Copy the header row from the table above (or from the downloaded template), put your own rows underneath, and paste the whole thing here. It is checked against the layout before anything is imported.
Or click a row in the preview below.
For a units or notes row.
Search every source at once. World Bank indicators need countries and years; everything else loads in one click.
Loading the catalogue…
The engine stays loaded, so this is quick - and it leaves your open tab and panel layout alone.
⌘/Ctrl+Enter runs the current analysis. ⌘/Ctrl+P exports the session as a PDF. Esc closes this.
In the Notebook: Enter starts a new block and
Shift+Enter a new line inside one; Backspace at the start
joins back into the paragraph above; / on an empty line inserts anything.
⌘/Ctrl+B, I, E, H and
M apply bold, italic, code, highlight and maths.
#, ##, -, 1., > and
``` at the start of a line convert it.
Sign in to run unlimited analyses.
Scroll to pan · Esc to close