Index: trunk/Ohana/src/opihi/cmd.astro/fitplx_irls.c
===================================================================
--- trunk/Ohana/src/opihi/cmd.astro/fitplx_irls.c	(revision 39242)
+++ trunk/Ohana/src/opihi/cmd.astro/fitplx_irls.c	(revision 39243)
@@ -387,5 +387,5 @@
   double ax, ay;
   double bx, by;
-  double lambda;
+  double lambda_x, lambda_y;
   double sigma_robust_x, sigma_robust_y;
   double sigma_final_x,  sigma_final_y;
@@ -396,5 +396,5 @@
   ax = 0.0; ay = 0.0;
   bx = 0.0; by = 0.0;
-  lambda = 0.0;
+
   for (i = 0; i < Npts; i++) {
     Wx[i] = weight_cauchy(rx[i] / dX[i]);
@@ -415,6 +415,9 @@
   by /= 1.0 * (Npts - p);
 
-  sigma_robust_x = lambda * sqrt(bx) * sigma_hat * 2.385 / ax;
-  sigma_robust_y = lambda * sqrt(by) * sigma_hat * 2.385 / ay;
+  lambda_x = 1.0 + (p / Npts) * (1 - ax) / ax;
+  lambda_y = 1.0 + (p / Npts) * (1 - ay) / ay;
+  
+  sigma_robust_x = lambda_x * sqrt(bx) * sigma_hat * 2.385 / ax;
+  sigma_robust_y = lambda_y * sqrt(by) * sigma_hat * 2.385 / ay;
 
   // This is actually sigma^2, as that's the factor in the covariance (dumouchel 4.1)
