[R] Performing regression using R & C
Roger.Bivand at nhh.no
Fri Nov 19 08:48:21 CET 2004
On Thu, 18 Nov 2004, Greg Tarpinian wrote:
> I have found "Numerical Recipes in C" to be extremely
> helpful in my statistical studies. OLS is described
> in detail in this book.
Maybe just read the R code: src/library/stats/R/lm.R contains function
lm.fit(), which is a wrapper for the Fortran subroutine dqrls(), and is
about as finely honed as you get. It won't give you the standard errors,
but you get the coefficients and the qr object, from which the rest can be
constructed. Using well-supported and maintained code does save time too!
But maybe there are moving window functions around that you can use
without having to "roll your own", searching on "moving window" at
http://finzi.psych.upenn.edu/search.html gave 85 hits, including the
following, which you may find fruitful:
> --- Manoj - Hachibushu Capital <Wanzare at HCJP.com>
> > Dear All,
> > Is it possible to perform OLS using C code? I am
> > trying to
> > optimize a n-period "moving window" OLS on a huge
> > dataset hence was
> > wondering if such a thing is possible.
> > Ideally the solution that I am looking for would
> > involve a
> > C-code accepting two float arrays and returning back
> > computed parameters
> > such as t-stat, coefficient etc.
> > I have glanced thru the FAQ's and tried to google
> > this
> > information but wasn't able to find anything truly
> > relevant, hence would
> > really appreciate your help on this one.
> > Thanks.
> > Manoj
> > ______________________________________________
> > R-help at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide!
> > http://www.R-project.org/posting-guide.html
> R-help at stat.math.ethz.ch mailing list
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Breiviksveien 40, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93
e-mail: Roger.Bivand at nhh.no
More information about the R-help