[R] Urgent Inquiry

Woo Young Kang erickwy at hotmail.com
Wed Feb 12 22:09:33 CET 2014

Hi, my name is Woo Young Kang and I am a current user of R-programming.
I am looking for an R-programming online questioning community and was having difficulty finding it.
I wonder what webaddress I can use to ask question regarding the R-programming.
Before that, I do have one critical question that I would like to ask regarding the R-programming.
I am trying to make about 10 lines of MATLAB code into the equivalent R-programming code.
The backgroud for this is to produce initial parameters for the Cox-Ross-Ingersoll short rate model using the
OLS method.

I found out the MATLAB code for OLS initial parameter estimation for the CIR interest rate model from 
one of the literature but have a bit difficulty in understanding 100% of the code since I was trying to convert 
this code in terms of R-programming code.
The code itself is as follows:
% Initial parameters using OLS
    Nobs = length(Model.Data);
    x = Model.Data(1:end-1);
    dx = diff(Model.Data);           
    dx = dx./x.^0.5;
    regressors = [Model.TimeStep./x.^0.5, Model.TimeStep*x.^0.5];
    drift = regressors\dx;
    res = regressors*drift - dx;
    alpha = -drift(2);
    mu = -drift(1)/drift(2);
    sigma = sqrt(var(res, 1)/Model.TimeStep);
    InitialParams = [alpha mu sigma];
    if ~isfield(Model, 'Disp'), Model.Disp = 'y'; end;
    if strcmp(Model.Disp, 'y')
        fprintf('\n initial alpha = %+3.6f\n initial mu    = %+3.6f\n initial sigma = %+3.6f\n', alpha, mu, sigma);

% where
%Model.Data   = Time series of interest rates observations
% Model.TimeStep   = Delta t; recommended: 1/250 for daily data, 1/12 for monthly data                                                  

I am attaching also the source of this code to this email as well which is one of the literature that I found recently.
The relavent source in the literature for your reference is in the section 2.2. initial estimates.
Since my main purpose of this is to convert this into the R-programming code,
it would be great if I could know the equivalent R-programming code for this MATLAB code,
and also the online R-programming questioning website address as well.
Thank you very much!
Woo Young Kang


-------------- next part --------------
A non-text attachment was scrubbed...
Name: maximum likelihood estimation of the cox-ingersoll-ross process the matlab implementation.pdf
Type: application/pdf
Size: 225502 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20140212/7997bb96/attachment.pdf>

More information about the R-help mailing list