Index: /trunk/Ohana/src/relastro/doc/irls.txt
===================================================================
--- /trunk/Ohana/src/relastro/doc/irls.txt	(revision 39366)
+++ /trunk/Ohana/src/relastro/doc/irls.txt	(revision 39366)
@@ -0,0 +1,116 @@
+
+I have run a set of tests of IRLS fitting both with and without Bootstrap resampling to measure the error distribution
+
+* parameter accuracy in the presence of outliers:
+
+** Fit Position with a fixed Proper Motion:
+
+Nout      stdev       reported err      stdev on err
+          Ro  Do          Ro   Do          Ro   Do      Nfit    chisq
+simple fit
+   0 :  1.00  0.98  :   1.00   1.00  :   0.00   0.00  : 100.00  -
+   3 :  2.59  2.64  :   0.98   0.98  :   0.00   0.00  : 103.00  -
+  10 :  4.31  4.17  :   0.95   0.95  :   0.00   0.00  : 110.00  -
+  30 :  6.17  6.11  :   0.88   0.88  :   0.00   0.00  : 130.00  -
+ 100 :  7.25  7.36  :   0.71   0.71  :   0.00   0.00  : 200.00  -
+pure IRLS
+   0 :  1.00  1.05  :   4.23   4.23  :   1.07   1.07  :  99.99  1.00
+   3 :  1.04  1.04  :   4.42   4.41  :   1.12   1.12  : 100.08  1.00
+  10 :  1.07  1.07  :   5.93   5.92  :   1.44   1.43  : 100.29  1.02
+  30 :  1.14  1.10  :  11.73  11.70  :   2.63   2.62  : 101.03  1.06
+ 100 :  1.33  1.33  : 298.72 299.62  : 157.64 161.02  : 105.08  1.47
+IRLS + bootstrap for errors
+   0 :  1.04  1.03  :   0.99   0.99  :   0.12   0.12  :  99.99  1.00
+   3 :  1.03  1.02  :   0.99   0.99  :   0.12   0.12  : 100.08  1.00
+  10 :  1.04  1.07  :   0.99   0.99  :   0.12   0.12  : 100.28  1.01
+  30 :  1.13  1.15  :   1.01   1.01  :   0.12   0.12  : 101.03  1.06
+ 100 :  1.33  1.33  :   1.16   1.16  :   0.16   0.16  : 104.98  1.46
+
+** Fit Position + Proper Motion:
+
+Nout             stdev                    reported err                  stdev on err
+          Ro  Do      uR  uD         Ro   Do       uR   uD         Ro   Do       uR   uD     Nfit    chisq
+simple fit
+   0 :  1.00  1.04  0.70  0.72 :   1.00   1.00   0.70   0.70 :   0.00   0.00   0.03   0.03 : 100.00   -
+   3 :  2.63  2.68  1.81  1.82 :   0.98   0.98   0.69   0.69 :   0.00   0.00   0.03   0.03 : 103.00   -
+  10 :  4.27  4.17  3.01  2.95 :   0.95   0.95   0.67   0.67 :   0.00   0.00   0.03   0.03 : 110.00   -
+  30 :  6.17  6.04  4.35  4.34 :   0.88   0.88   0.61   0.61 :   0.00   0.00   0.02   0.02 : 130.00   -
+ 100 :  7.14  7.37  5.13  5.08 :   0.71   0.71   0.49   0.49 :   0.00   0.00   0.02   0.02 : 200.00   -
+pure IRLS		         	      	     	    	     	  	        
+   0 :  1.05  1.01  0.72  0.73 :   4.24   4.26   2.97   2.97 :   1.05   1.07   0.74   0.76 :  99.99  1.00
+   3 :  1.05  1.06  0.72  0.72 :   4.47   4.47   3.12   3.12 :   1.10   1.10   0.78   0.78 : 100.08  1.01
+  10 :  1.07  1.06  0.73  0.74 :   5.94   5.94   4.15   4.15 :   1.45   1.44   1.03   1.02 : 100.28  1.02
+  30 :  1.14  1.17  0.80  0.80 :  11.83  11.83   8.25   8.25 :   2.60   2.62   1.85   1.85 : 101.05  1.07
+ 100 :  1.35  1.36  0.95  0.94 : 300.22 299.65 208.97 208.57 : 153.02 152.12 107.38 106.70 : 105.03  1.47
+IRLS + bootstrap for errors      	      	     	    	     	  	        
+   0 :  1.04  1.02  0.71  0.71 :   0.99   0.99   0.69   0.69 :   0.12   0.12   0.10   0.10 :  99.99  1.00
+   3 :  1.04  1.05  0.73  0.73 :   0.99   0.99   0.69   0.69 :   0.12   0.12   0.10   0.10 : 100.07  1.00
+  10 :  1.08  1.06  0.75  0.74 :   1.00   1.00   0.69   0.69 :   0.12   0.12   0.10   0.10 : 100.30  1.02
+  30 :  1.13  1.14  0.78  0.79 :   1.02   1.01   0.71   0.70 :   0.12   0.13   0.10   0.10 : 101.05  1.07
+ 100 :  1.34  1.34  0.95  0.94 :   1.16   1.17   0.81   0.81 :   0.16   0.16   0.14   0.14 : 105.08  1.48
+
+** Fit Position, Proper Motion, Parallax:
+
+Nout             stdev                          reported err                         stdev on err
+          Ro  Do      uR  uD    plx        Ro   Do       uR   uD     plx        Ro   Do       uR   uD     plx    Nfit    chisq
+simple fit
+   0 :  1.01  1.01  0.71  0.70  1.27 :   1.00   1.00   0.70   0.70   1.27 :   0.01   0.00   0.03   0.03   0.14 : 100.00   -
+   3 :  2.61  2.65  1.84  1.83  3.36 :   0.99   0.99   0.69   0.69   1.25 :   0.01   0.00   0.03   0.03   0.14 : 103.00   -
+  10 :  4.28  4.31  2.96  3.01  5.39 :   0.96   0.95   0.67   0.67   1.21 :   0.00   0.00   0.03   0.03   0.13 : 110.00   -
+  30 :  6.10  6.00  4.35  4.29  7.85 :   0.88   0.88   0.62   0.61   1.11 :   0.00   0.00   0.02   0.02   0.12 : 130.00   -
+ 100 :  7.31  7.22  4.99  5.07  9.16 :   0.71   0.71   0.49   0.49   0.89 :   0.00   0.00   0.02   0.02   0.10 : 200.00   -
+pure IRLS		               	       	      	     	      	    	          	        
+   0 :  1.04  1.04  0.73  0.72  1.33 :   4.27   4.27   3.00   2.99   5.38 :   1.07   1.08   0.77   0.78   1.45 :  99.99  1.00
+   3 :  1.06  1.05  0.74  0.73  1.32 :   4.49   4.49   3.15   3.14   5.68 :   1.12   1.13   0.80   0.80   1.55 : 100.07  1.01
+  10 :  1.08  1.06  0.75  0.73  1.34 :   6.01   6.00   4.22   4.20   7.58 :   1.40   1.41   1.00   1.00   1.93 : 100.30  1.02
+  30 :  1.12  1.15  0.81  0.80  1.46 :  11.97  11.99   8.39   8.38  15.13 :   2.72   2.74   1.93   1.94   3.79 : 101.03  1.07
+ 100 :  1.35  1.38  0.97  0.97  1.71 : 305.97 305.93 213.96 213.26 385.91 : 162.99 162.57 113.99 113.41 208.58 : 105.06  1.48
+IRLS + bootstrap for errors            	       	     	     	      	    	          	        
+   0 :  1.03  1.04  0.73  0.70  1.31 :   0.99   0.99   0.69   0.69   1.25 :   0.12   0.12   0.10   0.10   0.21 :  99.99  1.00
+   3 :  1.01  1.04  0.74  0.73  1.35 :   0.99   0.99   0.69   0.69   1.25 :   0.12   0.12   0.10   0.10   0.21 : 100.08  1.00
+  10 :  1.07  1.07  0.75  0.75  1.33 :   1.00   1.00   0.70   0.70   1.27 :   0.12   0.12   0.10   0.10   0.22 : 100.28  1.02
+  30 :  1.16  1.17  0.78  0.79  1.44 :   1.02   1.02   0.71   0.71   1.28 :   0.12   0.13   0.11   0.11   0.22 : 101.03  1.07
+ 100 :  1.36  1.36  0.95  0.95  1.73 :   1.17   1.17   0.81   0.81   1.47 :   0.16   0.16   0.14   0.14   0.28 : 105.10  1.48
+
+The standard fit fails drastically as the number of outliers
+increases, at the same time reporting a smaller error than expected
+(because of the additional outlier points) and resulting in higher
+scatter.  Adding in the IRLS results in much more reliable parameter
+estimates, with the scatter degrading only by ~35% for equaly numbers
+of real points and outliers.  However, IRLS by itself does a poor job
+of determining the error on the fitted parameters.  The value of the
+error in the presence of down-weighted outliers is not well defined.
+The recipe attempts to compensate for the weighting, but fails.  The
+bootstrap analysis results in errors which are within ~10% of the true
+standard deviation of the data values, with a small downward bias for
+large numbers of outliers.
+
+Evolution of the reported error as a function of the number of
+bootstrap resample tests (using 20 outliers and 100 real data points):
+
+Nboot            stdev                          reported err                    stdev on err
+          Ro  Do      uR  uD    plx       Ro  Do      uR  uD    plx       Ro  Do      uR  uD    plx    Nfit    chisq
+Position with fixed Proper Motion
+  20 :  1.11  1.11  0.00  0.00  0.00 :  0.99  1.00  0.00  0.00  0.00 :  0.22  0.22  0.00  0.00  0.00 : 100.64  1.04
+  30 :  1.07  1.09  0.00  0.00  0.00 :  1.00  1.00  0.00  0.00  0.00 :  0.19  0.18  0.00  0.00  0.00 : 100.62  1.04
+ 100 :  1.08  1.09  0.00  0.00  0.00 :  1.00  1.00  0.00  0.00  0.00 :  0.12  0.12  0.00  0.00  0.00 : 100.63  1.03
+ 300 :  1.09  1.09  0.00  0.00  0.00 :  1.00  1.00  0.00  0.00  0.00 :  0.09  0.09  0.00  0.00  0.00 : 100.61  1.03
+1000 :  1.10  1.10  0.00  0.00  0.00 :  1.00  1.01  0.00  0.00  0.00 :  0.08  0.08  0.00  0.00  0.00 : 100.63  1.04
+Position + Proper Motion
+  20 :  1.11  1.10  0.78  0.76  0.00 :  1.00  0.99  0.69  0.70  0.00 :  0.22  0.22  0.16  0.17  0.00 : 100.64  1.04
+  30 :  1.09  1.11  0.76  0.77  0.00 :  0.99  1.00  0.70  0.70  0.00 :  0.18  0.18  0.14  0.14  0.00 : 100.60  1.04
+ 100 :  1.13  1.10  0.75  0.79  0.00 :  1.00  1.01  0.70  0.70  0.00 :  0.12  0.12  0.10  0.10  0.00 : 100.64  1.04
+ 300 :  1.11  1.11  0.74  0.76  0.00 :  1.01  1.01  0.70  0.70  0.00 :  0.09  0.09  0.09  0.09  0.00 : 100.64  1.04
+1000 :  1.12  1.11  0.77  0.76  0.00 :  1.01  1.01  0.70  0.70  0.00 :  0.08  0.08  0.08  0.08  0.00 : 100.62  1.04
+Position, Proper Motion, Parallax
+  20 :  1.10  1.09  0.77  0.77  1.43 :  1.01  1.00  0.70  0.70  1.26 :  0.22  0.22  0.17  0.17  0.32 : 100.62  1.04
+  30 :  1.10  1.12  0.77  0.78  1.40 :  1.00  1.00  0.70  0.70  1.27 :  0.19  0.19  0.14  0.14  0.28 : 100.60  1.04
+ 100 :  1.12  1.11  0.77  0.75  1.42 :  1.01  1.01  0.70  0.70  1.27 :  0.12  0.12  0.10  0.10  0.22 : 100.63  1.04
+ 300 :  1.13  1.10  0.78  0.79  1.42 :  1.01  1.01  0.71  0.70  1.28 :  0.09  0.09  0.09  0.08  0.19 : 100.64  1.04
+1000 :  1.10  1.11  0.78  0.78  1.40 :  1.01  1.01  0.71  0.70  1.27 :  0.08  0.08  0.08  0.08  0.18 : 100.62  1.04
+
+Bootstrap resampling to test the error distribution results in good
+error estimates, but the accuracy of the error estimate depends on the
+number of resamples.  With 100 resamples, the standard deviation of
+the position and proper motion errors are ~10% of the error value.
+For parallax, the standard deviation is about 20% of the value.
