Hi Ghana,
How can I use the LINEST functionality of Excel in my .NET code. Can I use
the Excel interopability dll or should I write the function code?
I'm not an expect when it comes to statistics or linear regression
calculations, but from a C# programming perspective I can say that if the
implementation of the LINEST function is all you need from Excel, then you
are probably better of in writing the function yourself.
But, if in the other hand your application is already using Excel for
something else (or using Excel sheets as the source data), then using Excel
to do the calculation (and C# to control Excel) would probably be your best
bet. As you see, it all depends.
If you wish to pursue the first route, a bit of googling could reveal sample
code in other languages (such as C++) that already implements what you want.
If I understand correctly, LINEST uses the least squares method. This topic
is for example discussed here:
http://www.statsoft.com/textbook/stathome.html
On the right, click "Linear Regression", and then scroll down about one
page.
Hope this helps you in your decision.
--
Regards,
Mr. Jani Järvinen
C# MVP
Helsinki, Finland
ja***@removethis.dystopia.fi http://www.saunalahti.fi/janij/