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 › Bond price, duration & convexity
Prices a coupon bond off its yield (or solves the yield from a price), then reports duration, convexity and DV01 and shows how far the linear duration estimate misses on a 100 bp move.
A bond is a fixed stream of future cash. Its price is what that stream is worth today, so when the discount rate rises the price falls - always, and by an amount that depends on how far away the cash is. Duration measures that sensitivity as a single number. Convexity measures how wrong duration is, because the price-yield relationship is a curve and duration is only its tangent.
Valuing a fixed-coupon bond, measuring and hedging interest-rate risk, immunising a portfolio against a parallel yield shift, or converting between a bond's price and its yield to maturity.
Price is P=\sum_t C_t/(1+y)^t. Differentiating, dP/dy=-\sum_t t\,C_t/(1+y)^{t+1}, so the proportional sensitivity is -\frac{1}{P}\frac{dP}{dy}=\frac{1}{1+y}\sum_t t\,w_t with w_t=\frac{C_t/(1+y)^t}{P}. The sum is MACAULAY duration, a weighted average time to payment measured in years; dividing by (1+y) gives MODIFIED duration, which is the percentage price change per unit of yield. The second derivative gives convexity, \mathcal{C}=\frac{1}{P(1+y)^2}\sum_t t(t+1)\,C_t/(1+y)^t, and the second-order approximation is \Delta P/P\approx-D_{mod}\Delta y+\tfrac12\mathcal{C}(\Delta y)^2.
P = \sum_{t=1}^{n}\frac{c}{(1+y)^{t}} + \frac{F}{(1+y)^{n}},\qquad D_{\text{mod}} = \frac{-1}{P}\frac{\partial P}{\partial y},\qquad \Delta P \approx -D_{\text{mod}}\,\Delta y\,P + \tfrac12\,C\,(\Delta y)^2 P
A 10-year bond paying 4% in semi-annual coupons, priced to yield 5%, costs 92.2054 - below par, because the coupon is below the yield. Macaulay duration is 8.2556 years, modified duration 8.0542, convexity 77.1117, and DV01 is 0.0743 per basis point. Now raise the yield by a full percentage point. Duration alone predicts 84.7790; the exact reprice is 85.1225, so the linear estimate understates the bond by 0.3435 - a third of a point, on a position of any size a real number. Adding the convexity term gives 85.1345, wrong by 0.0120, about a penny. That gap is the whole reason convexity is quoted beside duration: at 100 basis points the linear approximation is already visibly off, and it deteriorates with the square of the move, so at 300 basis points it is useless.
| If you see this | It means | Do this |
|---|---|---|
| Duration longer than maturity | An arithmetic error, unless the bond is leveraged | Recheck the cash flow schedule |
| Price moves badly mispredicted by duration | The yield change was large | Add the convexity term; duration is a tangent |
| Negative convexity reported | A call or prepayment feature | Correct behaviour, but the linear approximation is now unsafe in both directions |
| Duration of a floating-rate note near zero | Correct. It reprices at each reset | Use the time to next reset, not maturity |
| Yield entered as 6 rather than 0.06 | Percent versus decimal | Price will come out absurdly small |
| Portfolio duration far from the sum of parts | Weights not by market value | Duration aggregates by value weight, not by count |
Yield curve, for fitting the whole term structure rather than one bond. EMI, for the same discounting arithmetic run as a loan.
Black–Scholes option pricing · 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)
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