diff options
author | astrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675> | 2009-04-08 09:17:46 +0000 |
---|---|---|
committer | astrojhgu <astrojhgu@ed2142bd-67ad-457f-ba7c-d818d4011675> | 2009-04-08 09:17:46 +0000 |
commit | 61ee2ce37185c2b5b8b6d70064d80a0acabdfba5 (patch) | |
tree | acfdd2fb473ea36865e9990773adcdaa1d0c535d | |
parent | b83ba2fcaff13474f77d2ade0b573d0b4ca2fc3b (diff) | |
download | opt-utilities-61ee2ce37185c2b5b8b6d70064d80a0acabdfba5.tar.bz2 |
git-svn-id: file:///home/svn/opt_utilities@23 ed2142bd-67ad-457f-ba7c-d818d4011675
-rw-r--r-- | samples/linear.dat | 8 | ||||
-rw-r--r-- | statistics/chisq.hpp | 22 |
2 files changed, 22 insertions, 8 deletions
diff --git a/samples/linear.dat b/samples/linear.dat index 03849b6..22e5db8 100644 --- a/samples/linear.dat +++ b/samples/linear.dat @@ -1,4 +1,4 @@ -0 0 0 4 1 1 -1 0 0 7 1 1 -2 0 0 10 1 1 -3 0 0 13 1 1 +0 1 .5 4 0 0 +1 .1 1 8 0 0 +1.5 1 .1 10 0 0 +3 .3 1 13 0 0 diff --git a/statistics/chisq.hpp b/statistics/chisq.hpp index ed25051..4054c22 100644 --- a/statistics/chisq.hpp +++ b/statistics/chisq.hpp @@ -107,7 +107,7 @@ 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();
- Tx x=this->datas().get_data(i).get_x()+this->datas().get_data(i).get_x();
+ Tx x=this->datas().get_data(i).get_x();
Ty errx1=(eval_model(x1,p)-eval_model(x,p));
Ty errx2=(eval_model(x2,p)-eval_model(x,p));
//Ty errx=0;
@@ -121,13 +121,27 @@ namespace opt_utilities Ty y_err;
Ty errx=0;
- if(errx2>errx1)
+ if(errx1<errx2)
{
- errx=errx1>0?errx1:-errx1;
+ if(y_obs<y_model)
+ {
+ errx=errx1>0?errx1:-errx1;
+ }
+ else
+ {
+ errx=errx2>0?errx2:-errx2;
+ }
}
else
{
- errx=errx2>0?errx2:-errx2;
+ if(y_obs<y_model)
+ {
+ errx=errx2>0?errx2:-errx2;
+ }
+ else
+ {
+ errx=errx1>0?errx1:-errx1;
+ }
}
|