Revert using unweighted variance in weight calculation

This reverts commit 165e6805ab.
This commit is contained in:
Miroslav Lichvar
2011-04-28 17:12:39 +02:00
parent 7f12919fea
commit 66c7ac4d24
3 changed files with 9 additions and 18 deletions

View File

@@ -232,7 +232,6 @@ RGR_FindBestRegression
double *b0, /* estimated y axis intercept */
double *b1, /* estimated slope */
double *s2, /* estimated variance of data points */
double *us2, /* estimated unweighted variance of data points */
double *sb0, /* estimated standard deviation of
intercept */
@@ -251,7 +250,7 @@ RGR_FindBestRegression
{
double P, Q, U, V, W; /* total */
double resid[MAX_POINTS * REGRESS_RUNS_RATIO];
double ss, uss;
double ss;
double a, b, u, ui, aa;
int start, resid_start, nruns, npoints;
@@ -315,20 +314,17 @@ RGR_FindBestRegression
*b1 = b;
*b0 = a;
ss = uss = 0.0;
ss = 0.0;
for (i=start; i<n; i++) {
ss += resid[i - resid_start]*resid[i - resid_start] / w[i];
uss += resid[i - resid_start]*resid[i - resid_start];
}
npoints = n - start;
ss /= npoints - 2;
uss /= npoints - 2;
ss /= (double)(npoints - 2);
*sb1 = sqrt(ss / V);
aa = u * (*sb1);
*sb0 = sqrt((ss / W) + (aa * aa));
*s2 = ss * npoints / W;
*us2 = uss;
*s2 = ss * (double) npoints / W;
*new_start = start;
*dof = npoints - 2;