finding MLE by OLS initial parameters for CIR MODEL (kladivko contribution)
Show older comments
Hi,
I run the kladivko contribution for CIR model MLE of parameters
I run
Results = CIRestimation(g)
??? Warning: Struct field assignment overwrites a value with class "double".
See MATLAB 7.0.4 Release Notes, Assigning Nonstructure Variables As Structures Displays Warning for details.
> In CIRestimation at 34
initial alpha = +0.012735
initial mu = +0.233222
initial sigma = +0.120850
??? Undefined function or method 'mtimes' for input arguments of type 'struct'.
Error in ==> CIRobjective1 at 27
u = c*exp(-alpha*TimeStep)*DataL;
Error in ==> CIRestimation>@(Params)CIRobjective1(Params,Model) at 47
[Params, Fval, Exitflag] = fminsearch(@(Params)CIRobjective1(Params, Model), InitialParams, options);
Error in ==> fminsearch at 205
fv(:,1) = funfcn(x,varargin{:});
Error in ==> CIRestimation at 47
[Params, Fval, Exitflag] = fminsearch(@(Params)CIRobjective1(Params, Model), InitialParams, options);
Could you please help me why I get these errors?
I have attached the .m files.
Thank you, Masoud
Answers (2)
Jaime maihuire Irigoyen
on 28 Feb 2014
0 votes
You SHOULD enter the data in "structure" format, For example(Model=struct('Data',zeros(165,1),'TimeStep',1/12,'Disp','n','Method','besseli','MatlabDisp','off'). "Data" should be in colum from newest to oldest data. Therefore you can run the model and that is.
macintosh
on 9 Apr 2014
0 votes
I'm sorry, may I ask a question? Right now I'm working on univariate AR(1) model based on CIR to forecast yield curve in the future. But I guess I need CIR parameters for EACH day. So I'm trying to get cross-sectional estimate of CIR parameters. Can I use Kladivko's source code in "maximum likelihood estimation: matlab implementation" to get these parameters?
Thankyou so much for your help.
Categories
Find more on Financial Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!