[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] Where oh where did the correlation cofficient go?

From: Brian Gough
Subject: Re: [Help-gsl] Where oh where did the correlation cofficient go?
Date: Wed, 30 May 2007 11:27:49 +0100
User-agent: Wanderlust/2.14.0 (Africa) Emacs/21.3 Mule/5.0 (SAKAKI)

At Fri, 25 May 2007 06:31:49 -0700,
Jack Denman wrote:
> I must have done something wrong. I created the results of an ideal
> linear function of y = mx +b and did the regression on the values
> and calculated the value of rho. I did this to check the accuracy of
> my code. The answer was off by a factor of roughly fifty ( rho =
> 0.02 ). I used both unweighted and neutrally weighted function
> calls. Below is listed the results and the code.
> Where did I go wrong?

Sorry, the formula I gave you had a typo, it should be
cov01/sqrt(cov00*cov11).  Also, that gives the correlation of the fit
parameters.  For the correlation of the data, which is what you want,
you need to do:

  #include <gsl/gsl_statistics.h>

  cov01 = gsl_stats_covariance(x,1,y,1,n);
  cov00 = gsl_stats_variance(x,1,n);
  cov11 = gsl_stats_variance(y,1,n);

Brian Gough

Network Theory Ltd,
Publishing Free Software Manuals ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]