[R] Urgent Inquiry
Jeff Newmiller
jdnewmil at dcn.davis.CA.us
Thu Feb 13 00:00:34 CET 2014
You might consider reading http://cran.r-project.org/doc/contrib/Hiebeler-matlabR.pdf. I strongly recommend reading the Introduction to R document that comes with the R software.
As to where to ask questions, this mailing list is fine as long as you follow the Posting Guide recommendations (see the bottom of this email) and stay on topic (Matlab is off topic, R is on-topic). Note that most attachments are stripped by the mailing list.. you are expected to communicate in plain text.
Some people prefer the website experience... you might try http://stackoverflow.com/questions/tagged/r for that.
---------------------------------------------------------------------------
Jeff Newmiller The ..... ..... Go Live...
DCN:<jdnewmil at dcn.davis.ca.us> Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. with
/Software/Embedded Controllers) .OO#. .OO#. rocks...1k
---------------------------------------------------------------------------
Sent from my phone. Please excuse my brevity.
On February 12, 2014 1:09:33 PM PST, Woo Young Kang <erickwy at 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 at 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.
More information about the R-help
mailing list