diff options
author | Thomas White <taw@physics.org> | 2009-12-04 12:00:32 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2009-12-04 12:01:37 +0100 |
commit | ba72cc21bb8a36e3fb0ac8e7da69157ae1aed918 (patch) | |
tree | b2f1e905f3368ee1b02acf6ff6a4838645c37833 /src/statistics.c | |
parent | 5598807a938f9eea3f3663f770f598b6ece8edbc (diff) |
Fix R2 calculation
Diffstat (limited to 'src/statistics.c')
-rw-r--r-- | src/statistics.c | 11 |
1 files changed, 8 insertions, 3 deletions
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<size; i++ ) { if ( c[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); } |