Directory of Open Source for Quantitative Finance and Trading
Username: Password: Not registered?
 
Quick Search:    (AJAX based: No need to press button)

Main : .NET : 


Category: .NET View Full Details
Download Now!Multi regression with Standard Errors in C# using GSL
Submitter: vanna Date: 2011/1/19
Description:
The attached file contains a function DoMultiParameterFit to perform multi parameter regression.

Cioefficients are returned in parameter betaVec, while Standard Error is returned in out parameter stdErrorResiduals

Example usage:
        static void TestMultiParameterFit()
        {
            double[] obs = new double[]{
                0.775152156,
0.212969663,
0.494751764,
0.77712995,
1,
//0.748404191,
0.779557101,
2,
//0.38384782,
0.696799969,
0.674492839,
0.284649573,
0.496014531,
0.838613229

        };

            double[,] indepmat = new double[,]{
{1,0.788096265218347,0.746593708978196},
{1,0.0255426131849941,0.00457187860244002},
{1,0.248018064297132,0.514105818411815},
{1,0.552009242813257,0.953928496986185},
{1,0.616359144209673,0.823678881758479},
{1,0.910346382602459,0.627853132497875},
{1,0.120170501107987,0.347017026347369},
{1,0.333580471002668,0.936537292790489},
{1,0.820704328615048,0.457125411270979},
{1,0.115441459553873,0.10251203158771},
{1,0.0807673391304329,0.650217706388172},
{1,0.92757999311497,0.77972171347426}

            };

            double residualSumOfSquares;
            double[] stdErrorResiduals;
            double[] betavec;

            GSLHelper.DoMultiParameterFit(obs, indepmat,
                out betavec, out residualSumOfSquares, out stdErrorResiduals);

        }


Got a question or problem with this link? Just enter your message and click on submit. No registration is required.

Note: A copy of this message will also be emailed to the submitter of this link
Downloaded 279 times  279  File Size 0 bytes  Supported Platforms C# .NET GSL  Home Page http://www.quantcode.com/
Rating: 0.00 (0 votes)
Rate this File | Modify | Delete | Report Broken File | Tell a Friend | Comments (10)

Poster Thread
Anonymous
Posted: 2012/3/8 17:34  Updated: 2012/3/18 11:06
 Multi regression with Standard Errors in C# using GSL
My name is Sergei Belov (QuantCode user hyperstrings2003,
email hyperstrings2003@yahoo.com) I am MIT Math Ph.D with 15-year financial quant experience

I am testing your "Multi regression with Standard Errors in C# using GSL"
and am experiencing 2 strange problems:

1) when I compile "x86" (Debug or Release" I am getting the following error message:

Managed Debugging Assistant 'PInvokeStackImbalance' has detected a problem in 'C:\gsl-1.8-src\bin\Release\ConsoleApplication.vshost.exe'.
Additional Information: A call to PInvoke function 'ConsoleApplication!multfittest.GSL::gsl_matrix_set' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

But when I press "F5" many times (about 20) the program steps through all these error messages and continues correctly as successfully

2) When I am compiling with the options "x64" (Debug or Release" and copying GSL 64-bit DLL for C# use (which you provided in another download) the program crashes

Which DLLs should I use for 64-bit version

I really appreciate your help.

Hope to be able to contribute my code as well (at least privately to you)

Sergei

Discuss this file. Just enter your message and click on submit. No registration is required.
Similar Links:

Subscribe to RSS or daily email updates of latest quantitative finance code listings
Email address :
Copyright © 2011 QuantCode Inc. All rights reserved.