[R] Performing regression using R & C

Jim McLoughlin jimmcloughlin at earthlink.net
Fri Nov 19 19:21:50 CET 2004

> 	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.

It is probably not worth trying to call R to do OLS from C.  I would 
look at GSL:


GSL has a simple but elegant C interface for doing OLS and weighted 
least squares.  It will give you the covariance matrix of the model 
parameters, from which you can derive t-stats.

Jim M

More information about the R-help mailing list