[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Help-gsl] linear regression, f-statistic and vectors
From: |
Benjamin Otto |
Subject: |
[Help-gsl] linear regression, f-statistic and vectors |
Date: |
Thu, 26 Jul 2007 12:53:36 +0200 |
Dear list members,
First:
Can I calculate the f-statistic for a linear regression estimated with
gsl_fit_linear() with some of the GSL functions? My current little test
procedure is appended below. What I am still missing or do really look
for is the p-value of the f-statistic.
Second:
gsl_fit_linear expects two array of type double so for my previous tests
I just created some matching arrays. For future calculations I would
like to use vectors. Now can I transform a gsl_vector into such a
"normal" double array so it is accepted by the linear regression
function? I don't find any matching vector view in the manual. Or do I
have to loop over each single element, get the value and copy it into a
new double array?
best regards,
Benjamin Otto
#include <stdio.h>
#include <gsl/gsl_fit.h>
#include <gsl/gsl_randist.h>
int
main (void)
{
int n = 9;
double x[9] = { 1,2,3,4,5,6,7,8,9 };
double y[9] = { 2,3,5,4,6,7,9,0,10 };
double c0, c1, cov00, cov01, cov11, sumsq;
gsl_fit_linear (x, 1, y, 1, n,
&c0, &c1, &cov00, &cov01, &cov11,
&sumsq);
printf ("# best fit: Y = %g + %g X\n", c0, c1);
printf ("# covariance matrix:\n");
printf ("# [ %g, %g\n# %g, %g]\n",
cov00, cov01, cov01, cov11);
printf ("# sumsq = %g\n", sumsq);
return 0;
}
--
Pflichtangaben gemäß Gesetz über elektronische Handelsregister und
Genossenschaftsregister sowie das Unternehmensregister (EHUG):
Universitätsklinikum Hamburg-Eppendorf
Körperschaft des öffentlichen Rechts
Gerichtsstand: Hamburg
Vorstandsmitglieder:
Prof. Dr. Jörg F. Debatin (Vorsitzender)
Dr. Alexander Kirstein
Ricarda Klein
Prof. Dr. Dr. Uwe Koch-Gromus
- [Help-gsl] linear regression, f-statistic and vectors,
Benjamin Otto <=