aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorastrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675>2009-04-08 08:45:00 +0000
committerastrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675>2009-04-08 08:45:00 +0000
commit5d36501928944bdaf6e8ff13e85be48719509556 (patch)
tree47fb6c7f4b1ed6b4cc70a9b035b69f0fee84d729
parentee26228a27b682c0a1d6d55d619790040821bc0a (diff)
downloadopt-utilities-5d36501928944bdaf6e8ff13e85be48719509556.tar.bz2
git-svn-id: file:///home/svn/opt_utilities@21 ed2142bd-67ad-457f-ba7c-d818d4011675
-rw-r--r--statistics/chisq.hpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/statistics/chisq.hpp b/statistics/chisq.hpp
index 15b3d33..66a7a70 100644
--- a/statistics/chisq.hpp
+++ b/statistics/chisq.hpp
@@ -107,15 +107,28 @@ namespace opt_utilities
#ifdef HAVE_X_ERROR
Tx x1=this->datas().get_data(i).get_x()-this->datas().get_data(i).get_x_lower_err();
Tx x2=this->datas().get_data(i).get_x()+this->datas().get_data(i).get_x_upper_err();
- Ty errx=(eval_model(x1,p)-eval_model(x2,p))/2;
+ Ty errx1=(eval_model(x1,p)-eval_model(x,p));
+ Ty errx2=(eval_model(x2,p)-eval_model(x,p));
//Ty errx=0;
#else
- Ty errx=0;
+ Ty errx1=0;
+ Ty errx2=0;
#endif
Ty y_model=eval_model(this->datas().get_data(i).get_x(),p);
Ty y_obs=this->datas().get_data(i).get_y();
Ty y_err;
+
+ Ty errx=0;
+ if(errx2>errx1)
+ {
+ errx=errx1>0?errx1:-errx1;
+ }
+ else
+ {
+ errx=errx2>0?errx2:-errx2;
+ }
+
if(y_model>y_obs)
{