You may find http://stackoverflow.com/ to be a useful website to ask R
questions.

Kevin



On Wed, Feb 12, 2014 at 3:09 PM, Woo Young Kang <eric...@hotmail.com> wrote:

>
>
> 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);
>     end
>
> % 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!
>
>
> Sincerely,
> Woo Young Kang
>
>
>
>
>
>
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>


-- 
Kevin Wright

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to