On Mon, Nov 23, 2009 at 8:33 AM, Conoscenza Silente <abruzzoforteegentile@gmail.com> wrote:
I would like to calculate the covariance of 2 variables.
I did not really understand how to setup the accumulators for 2 or
more variables.
What role plays the covariate here and where to pick up or feed the
values for the second variable?
I'm not sure if it accomplishes exactly what you want, but the attached sample may be useful. It is a little program to compute some stats from an input file. It includes covariance details.
It uses autoconf and assumes you're on a un*x-ish system or Cygwin, so you'll want to use ./bootstrap && ./configure && make. The file you're after is src/stat.cc.
- Rhys