From ba72cc21bb8a36e3fb0ac8e7da69157ae1aed918 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 4 Dec 2009 12:00:32 +0100 Subject: Fix R2 calculation --- src/statistics.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/statistics.c b/src/statistics.c index 50bfd513..84453ffa 100644 --- a/src/statistics.c +++ b/src/statistics.c @@ -59,13 +59,18 @@ double stat_r2(double *obs, double *calc, unsigned int *c, int size, for ( i=1; i 0 ) { + double obsi; + obsi = obs[i] / (double)c[i]; - top += pow(fabs(obsi - scale*calc[i]), 2.0); + obsi = obsi / scale; + + top += pow(fabs(obsi - calc[i]), 2.0); bot += pow(obsi, 2.0); - } - } /* else reflection not measured so don't worry about it */ + } /* else reflection not measured so don't worry about it */ + + } return sqrt(top/bot); } -- cgit v1.2.3