Regression problem

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Regression problem

David Muldowney
Hi
I'm very new to QuantLib so forgive my innocence here.
My problem is a regression calculation, ex-post Alpha and Beta given a set of returns for a fund and a benchmark.
Calculating Beta and Alpha boils down to getting the best-fit line (min. least squares problem I guess) and then reading it's slope and intercept.
I've looked at the documentation and I think my best bet seems to involve LineSearch (in the Optimisation namespace), but I'm open to correction.
I'm doing the code in VB.Net but i
f anyone can give me an example of how this class (or ones more appropriate to my problem) are used (C++ / C# would do) I would be immensely grateful
Regards
David
Reply | Threaded
Open this post in threaded view
|

Re: Regression problem

Nicolas Di Césaré
Selon David Muldowney <[hidden email]>:

> Hi
> I'm very new to QuantLib so forgive my innocence here.
> My problem is a regression calculation, ex-post Alpha and Beta given a set of
> returns for a fund and a benchmark.
> Calculating Beta and Alpha boils down to getting the best-fit line (min.
> least squares problem I guess) and then reading it's slope and intercept.
> I've looked at the documentation and I think my best bet seems to involve
> LineSearch (in the Optimisation namespace), but I'm open to correction.
> I'm doing the code in VB.Net but if anyone can give me an example of how this
> class (or ones more appropriate to my problem) are used (C++ / C# would do) I
> would be immensely grateful
> Regards
> David
>

Hi David,

The optimization framework has been made for non linear problems. It should
allow you to treat linear ones (*) but it is not optimal. I think that a
regression problem reduces to a symetric matrix inversion that can be solve
using direct or iterative methods.

Nicolas

(*) Indeed, you have to define a cost function class (deriving from CostFunction
class) describing your problem (ie implementing the value(const Array& params)
method). At the end, you have to use the Simplex method to solve your problem.



 
--
Nicolas Di Césaré
http://nicolas.dicesare.free.fr