[R] C code for KalmnaLike
pgilbert at bank-banque-canada.ca
Wed Sep 10 16:34:57 CEST 2003
orasi at stat.unibo.it wrote:
>it is possible to see the C code for the KalmanLike and Kalmansmooth functions with R?
It is possible to see all the code distributed with R and the R packages
on CRAN. (This is why it is sometimes called an open source project.)
Kalman smoothing and Kalman filtering, on which the likelihood
calculation is usually based, are not part of base R, but are in
packages. I am not sure about other packages, but the versions in the
dse package are not written in C. There is a fortran version and an
equivalent R version. There is a C version which is translated with f2c,
but that is not the place to look if you are trying to understand the
algorithm. The easiest code to read is the R version, but the fortran it
the one that is used (by default) for reason of speed.
>Otherwise, without using R, how can I get the code?
You can download the source from CRAN and examine it without using R.
However, if you actually want to use the code, then I strongly suggest
you use R too. The R code makes a call to fortran in order to speed the
iterative part of the calculation, but the likelihood calculation from
the residuals, all the error checking, plotting, and "nice to use"
features are in the R code. If you want to use dse, then start by
reading the dse user's guide distributed with the package bundle (in
dse1/inst/doc/dse-guide.pdf) and getting familiar with R. (When I have
been asked questions like your's before, the next question has usually
be something like: please give me a tutorial on the internal details of
your code, because I want to pull it apart and use it somewhere else.
I am not very interested in the effort required for me to do that.)
More information about the R-help