Download presentation
Presentation is loading. Please wait.
1
Financial Data Modelling
Dr Nikolay Nikolaev Department of Computing Goldsmiths College University of London 2018
2
Lecture (FDM 2018) Portfolio Selection The objective of portfolio selection is to assemble efficient portfolios that lead to acceptable rate of return with minimal risk. When a single asset is added to a portfolio it changes the efficient frontier in the risk-return space, and thus it changes the usefulness of the whole portfolio. The portfolios below the efficient frontier are not optimal as they do not lead to enough return for the concrete risk. The task of portfolio selection includes estimation of the risk of the particular candidate assets. The relationship between the return on an asset and the return on the overall market is formulated with the Capital Asset Pricing Model (CAPM), which is an important concept in finance. According to the CAPM model the difference between the return on chosen asset and the return on the overall market reflects its exposure to risk. The sensitivity of an asset to the market is specified by the so called beta variable in the portfolio equation. The equation of the original unconditional CAPM pricing model states that the excess return on asset 𝑟 𝑖,𝑡 = 𝑅 𝑖,𝑡 - 𝑟 𝑡 𝑓 is linearly related to the excess return on the market portfolio 𝑟 𝑚,𝑡 = 𝑅 𝑚,𝑡 - 𝑟 𝑡 𝑓 as follows: 𝑟 𝑖,𝑡 = 𝛼 𝑖 + 𝛽 𝑖 𝑟 𝑚,𝑡 + 𝜀 𝑖,𝑡 𝜀 𝑖,𝑡 ~ 𝑵(0, 𝜎 𝑖 2 ) where 𝛼 𝑖 is the intercept, 𝜀 𝑖,𝑡 is a zero-mean iid variable, and 𝛽 𝑖 denotes the systematic risk of the i-th asset with respect to the market.
3
𝛽 𝑖 = 𝐶𝑜𝑣( 𝑟 𝑚,𝑡 , 𝑟 𝑖,𝑡 ) / 𝑉𝑎𝑟( 𝑟 𝑚,𝑡 )
Lecture (FDM 2018) The unconditional 𝛽 𝑖 is a constant computable as the ratio of the covariance between the asset and market returns 𝐶𝑜𝑣( 𝑟 𝑚,𝑡 , 𝑟 𝑖,𝑡 ) and the market variance 𝑉𝑎𝑟( 𝑟 𝑚,𝑡 ), that is: 𝛽 𝑖 = 𝐶𝑜𝑣( 𝑟 𝑚,𝑡 , 𝑟 𝑖,𝑡 ) / 𝑉𝑎𝑟( 𝑟 𝑚,𝑡 ) Having computed 𝛽 𝑖 we can also estimate the total risk of the asset, and the average risk 𝛽 of the whole portfolio. Small portfolio 𝛽 indicates a non-aggressive portfolio which may not outperform the market index. Along with this we have to look at the unique (error) risk of the portfolio which if small means well balanced portfolio. The values of the intercept 𝛼 𝑖 show whether the asset is underpriced ( 𝛼 𝑖 >0). Current research shifts the focus when evaluating riskness from the variance to the analysis of 𝛽 𝑖 parameter. More precisely contemporary CAPM models are developed using time-varying (non-constant) beta that capture more accurately the dynamics and stochastic character of prices. There are several such approaches to finding conditional betas: the first approach estimates the conditional variances of returns with GARCH models, that is there is a separate GARCH model for the variance of asset returns and for the variance of the market return, and they are taken to evaluate their covariance; the second approach infers the variances of the returns with stochastic volatility models; the third approach estimates directly the time-varying 𝛽 𝑖 with Kalman filters that capture properly their latent dynamic behaviour.
4
Filtering the CAPM Model
Lecture (FDM 2018) Filtering the CAPM Model Contemporary research in the CAPM model considers state-space formulations with time-varying beta parameters. There are investigated several such state-space CAPM models with different beta dynamics: random walk dynamics, autoregressive dynamics, mean-reverting dynamics. All these versions estimate sequentially the beta parameter with the Kalman filtering equations. Here we are going to study a Kalman filter for the CAPM model with autoregressive dynamics for both the alpha and beta parameters. The state-space formulation of the CAPM model (for a single asset) with time-varying alpha and beta having autoregressive dynamics is as follows: process equation 𝑟 𝑖,𝑡 = 𝛼 𝑖 + 𝛽 𝑖,𝑡 𝑟 𝑚,𝑡 𝜀 𝑖,𝑡 ~ 𝑵(0, 𝜎 𝑖 2 ) observation equations 𝛽 𝑖,𝑡 = 𝑓 22 𝛽 𝑖,𝑡−1 + 𝑞 2,𝑡 𝑞 2,𝑡 ~𝑁(0, 𝑄 2 ) 𝛼 𝑖,𝑡 = 𝑓 11 𝛼 𝑖,𝑡−1 + 𝑞 1,𝑡 𝑞 1,𝑡 ~𝑁(0, 𝑄 1 ) where 𝑞 1,𝑡 and 𝑞 2,𝑡 are zero-mean iid Gaussian noises of the state vector.
5
𝒔 𝑖,𝑡|𝑡 = 𝒔 𝑖,𝑡|𝑡−1 + 𝑘 𝑡 𝑟 𝑖,𝑡 − 𝒔 𝑖,𝑡|𝑡−1 𝑥 𝑡
Lecture (FDM 2018) The Kalman filter can be used to perform minimum mean-squared error learning of both the alpha and beta parameters conditioned on all past information arrived up to the current moment as follows: prediction step: 𝒔 𝑖,𝑡|𝑡−1 = 𝐹𝒔 𝑖,𝑡−1|𝑡−1 (where: 𝒔 𝑖,𝑡−1|𝑡−1 = [ 𝛼 𝑖,𝑡−1 𝛽 𝑖,𝑡−1 ] and 𝐹= 𝑃 𝑡|𝑡−1 = 𝐹𝑃 𝑡−1|𝑡−1 𝐹+𝑄 updating step: 𝑘 𝑡 = 𝑃 𝑡|𝑡−1 𝑥 𝑡 𝑇 𝑥 𝑡 𝑃 𝑡|𝑡−1 𝑥 𝑡 𝑇 +𝑅 −1 (where: 𝑥 𝑡 = [1 𝑟 𝑚,𝑡 ] ) 𝒔 𝑖,𝑡|𝑡 = 𝒔 𝑖,𝑡|𝑡−1 + 𝑘 𝑡 𝑟 𝑖,𝑡 − 𝒔 𝑖,𝑡|𝑡−1 𝑥 𝑡 𝑃 𝑡|𝑡 = 𝑃 𝑡|𝑡−1 − 𝑘 𝑡 𝒔 𝑡 𝑃 𝑡|𝑡−1 where 𝑟 𝑖,𝑡 the observed return on the particular 𝑖-th asset at time 𝑡. The returns 𝑅 𝑖,𝑡 in 𝑟 𝑖,𝑡 = 𝑅 𝑖,𝑡 − 𝑟 𝑡 𝑓 can be computed using the prices 𝑅 𝑖,𝑡 = 𝑃 𝑖,𝑡 / 𝑃 𝑖,𝑡−1 − 1 (or 𝑅 𝑖,𝑡 = 𝑃 𝑖,𝑡 − 𝑃 𝑖,𝑡−1 ) and it is recommended to normalize the prices in advance. The unknown state transition matrix F can be found using a standard optimizer, or computed using the Expectation Maximization (EM) algorithm for time series that includes a filtering step, a backward smoothing step and another forward parameter estimation step.
6
Exercise: Estimating the CAPM alpha and beta in Matlab
Lecture (FDM 2018) Exercise: Estimating the CAPM alpha and beta in Matlab % Load the asset prices Pri = load(‘Prices.dat'); % Load the market portfolio prices Pm = load(‘Market.dat'); % Load the interest rate rf = load('T-billrates.dat'); % Compute returns Ri = zeros(T,1); Rm = zeros(T,1); for t = 2:T Ri(t) = Pri(t)./Pri(t-1)-1; Rm(t) = Pm(t)/Pm(t-1)-1; end % Calculate the excess return ris = zeros(T,1); rms = zeros(T,1); ris(t) = Ri(t)-rf(t); rms(t) = Rm(t)-rf(t); % Compute static alpha and beta covar = cov(ris,rms); beta = covar(1,2)/var(rms); alpha = mean(ris)-beta*mean(rms); fprintf('\n Static : alpha = %2.6f, beta = %2.6f',alpha,beta);
7
Lecture (FDM 2018) Exercise: Least squares estimation of the CAPM alpha and beta in Matlab % OLS estimation xv = [ones(T,1) rms]; xxi = (xv'*xv)\eye(2); olsp = xxi*(xv'*ris); alpha1 = olsp(1); beta1 = olsp(2); yhat = xv*olsp; fprintf('\n OLS estimates: alpha = %2.6f, beta = %2.6f',alpha1,beta1);
8
Exercise: Kalman filtering of the CAPM alpha and beta in Matlab
Lecture (FDM 2018) Exercise: Kalman filtering of the CAPM alpha and beta in Matlab % Time-varying beta using Kalman filter F = [1,0; 0,1]; Q = [0.001,0; 0,0]; R = 1.0; st = [0; 1]; Pt = [1.0 0; 0 1.0]; for t = 2:T s1 = F*st; P1 = F*Pt*F'+Q; x = [1,rms(t)]; yhat = x*s1; innov = ris(t)-yhat; kg = P1*x'/(x*P1*x'+R); st = s1+kg*innov; Pt = P1-kg*x*P1; end fprintf('\n Filtered : alpha = %2.6f, beta = %2.6f',xt(1),xt(2));
9
Lecture (FDM 2018) References: M.Gastaldi and A.Nardecchia (2003). The Kalman Filter Approach For Time-Varying β Estimation, Systems Analysis Modelling Simulation, vol.43 (8), pp.1033–1042. A.Das and T.K.Ghoshal (2010). Market Risk Beta Estimation using Adaptive Kalman Filter, Int. Journal of Engineering Science and Technology, vol.2 (6), pp
Similar presentations
© 2025 SlidePlayer.com Inc.
All rights reserved.