How do I calculate standard errors for mean reversion parameter estimates?
3 次查看(过去 30 天)
显示 更早的评论
Hi,
I use the following code from http://www.mathworks.com/matlabcentral/fileexchange/28056-energy-trading-risk-management-with-matlab-webinar-case-study/content/html/ModelNGPrice.html
in order to calibrate a Vasicek model:
x = log(S);
dx = diff(x);
dt = 1; %
dxdt = dx/dt;
x(end) = []; % To ensure the number of elements in x and dxdt match
% Fit a linear trend to estimate mean reversion parameters
coeff = polyfit(x, dxdt, 1);
res = dxdt - polyval(coeff, x);
revRate = -coeff(1)
meanLevel = coeff(2)/revRate
vol = std(res) * sqrt(dt)
And finally..
ste = sqrt(diag(inv(s.R)*inv(s.R')).*s.normr.^2./s.df);
provides the standard errors for the two estimated coefficients.
What is the standard error for meanLevel and vol?
Any hints are highly appreciated.
0 个评论
回答(0 个)
另请参阅
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!