Portfolio dashboard
An interactive quantitative portfolio lab
Kalman Portfolio Lab
The three approaches
Concepts and theory →Approach 1
Market factor model
Regress each asset on observable signals such as the S&P 500 and VIX. Each beta is a random-walk state tracked by its own Kalman filter, so sensitivities drift over time and forecast bands scale with realised volatility.
Approach 2
Hidden factor model
Extract latent factors from the return matrix with EM-PCA, fit a VAR to their dynamics and Kalman-filter the state. Shows how much co-movement a few factors explain, and how little of it is predictable a day ahead.
Approach 3
Portfolio optimiser
Walk-forward latent risk model with adaptive noise, feeding a long-only optimiser that weighs a one-off trading cost against the holding period. Pure risk model by default; the return signal is optional and evaluated against equal weight with a bootstrap interval.
Universe
Pick the holdings and window. At least two assets are needed for the latent-factor models and the optimiser.
Pick from the list or type any ticker and press Enter.
Up to 10 years of history.
Optional: shows dollar amounts. 0 = log-return view.
Trading days to forecast beyond the window.
Recommended setup
1 suggestion
- WindowRecommended: ≥ 250 trading days
About 392 trading days. Windows from 250 to 1000 days gave the same forecast accuracy and the best-calibrated bands on five years of data.
- AssetsRecommended: 10 or more
6 assets: expect roughly 5 to 10% lower realised volatility than equal weight. The benefit grows with breadth (about 20% at 15 assets, 26% at 40).
- Forecast horizonRecommended: 5 to 60 days
Bands were calibrated at 5, 20 and 60 days. The point forecast equals the historical mean at every horizon tested; read the band, not the line.
Based on rolling-origin tests over five years of real data (scripts/eval). Guidance only; nothing here changes what runs.
Used as the starting allocation and to roll per-asset forecasts up to portfolio level.
Model comparison
Factor models are judged on explanatory power and forecast skill; the optimiser on realised risk and cost against equal weight.
What the lab shows
Reading across the three approaches
Not run yet
Frequently asked questions
What is Kalman Portfolio Lab?
Kalman Portfolio Lab is a free web app for exploring quantitative portfolio models on real market data. You pick a basket of stocks and it runs three approaches side by side: a market factor model with time-varying betas, a hidden (latent) factor model, and a portfolio optimiser driven by an adaptive risk model. Each one shows forecasts with uncertainty bands, and the optimiser shows the resulting allocation.
Does Kalman Portfolio Lab predict stock returns?
No. Daily stock returns are close to unpredictable, and the lab says so: its one-day-ahead forecasts sit near the historical average, and in out-of-sample tests the return signals added no predictive value. What the models estimate usefully is risk, meaning how wide the range of likely outcomes is and how assets move together. For that reason the optimiser runs as a pure risk model by default.
What is a Kalman filter, and why use one for portfolios?
A Kalman filter is a recursive algorithm that estimates a hidden, changing quantity from noisy observations, updating its estimate every time a new data point arrives. In portfolio modelling the hidden quantities are things you cannot observe directly, such as how sensitive a stock currently is to the market. The lab uses Kalman filters to track time-varying betas, to follow hidden factors, and to adapt its noise estimates as market volatility changes.
What is a dynamic factor model?
A dynamic factor model explains the returns of many assets with a small number of common drivers, called factors, that evolve over time. The factors can be observable, such as the S&P 500 or the VIX, or hidden, in which case they are inferred from the returns themselves with principal component analysis. Writing the model in state-space form lets a Kalman filter estimate it and produce forecasts with uncertainty bands.
What is the difference between the three approaches?
Approach 1, the Market Factor Model, explains each stock with observable signals such as the S&P 500 and VIX and lets a Kalman filter track how each stock's sensitivity (beta) drifts. Approach 2, the Hidden Factor Model, discovers the common drivers from the returns themselves with principal components, fits their dynamics and filters them. Approach 3, the Portfolio Optimiser, turns a walk-forward risk model into long-only portfolio weights, weighing trading costs against the expected holding period.
What is mean-variance optimisation, and how does the lab make it less fragile?
Mean-variance optimisation, introduced by Harry Markowitz, chooses portfolio weights that trade expected return against risk. It is known to be fragile: small errors in the inputs produce extreme, concentrated portfolios. The lab counters this with a smoothed risk model (an iterated exponentially weighted covariance), covariance shrinkage, long-only weights with a per-asset cap, and a turnover penalty that compares the one-off cost of trading with the benefit of holding the new position.
How should I read the forecast bands?
The bands show a range of likely outcomes, not a prediction of direction. The inner band is where the model expects returns to land about 2 times in 3, and the outer band about 19 times in 20. The bands widen when recent market volatility has been high and narrow when it has been calm. Every chart in the lab also carries a plain-English "What this means" note for readers without a finance background.
What data does Kalman Portfolio Lab use?
The lab downloads daily adjusted closing prices from Yahoo Finance when you run a model and converts them to daily log returns. You can choose your own stock tickers and date range, and Approach 1 lets you pick the market signals, for example the S&P 500, the VIX, Treasury yields or sector ETFs.
How are the models evaluated?
Honestly, and out of sample. The optimiser is backtested walk-forward, so every decision uses only data available before that day, and it is compared net of trading costs with a simple equal-weight portfolio, with a bootstrap confidence interval on the difference. Forecast bands are scored on rolling-origin forecasts for how often outcomes actually land inside them. Ideas that were tested and did not pass are documented in the project's README instead of being hidden.
Is Kalman Portfolio Lab free, and is it investment advice?
The lab is free to use, with no account needed. It is an educational and research tool, not investment advice: it does not recommend buying or selling any security, and past model behaviour says nothing certain about future returns.