Use 5% critical region for number of runs
This results in more samples used in regression and slightly improved response with high jitters.
This commit is contained in:
parent
e591e3622b
commit
5344028c40
1 changed files with 19 additions and 19 deletions
38
regress.c
38
regress.c
|
@ -172,23 +172,23 @@ typedef struct {
|
||||||
} RegressionResult;
|
} RegressionResult;
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
/* Critical value for number of runs of residuals with same sign. 10%
|
/* Critical value for number of runs of residuals with same sign.
|
||||||
critical region for now */
|
5% critical region for now. */
|
||||||
|
|
||||||
static char critical_runs10[] = {
|
static char critical_runs[] = {
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 3, 3,
|
0, 0, 0, 0, 0, 0, 0, 0, 2, 3,
|
||||||
4, 4, 4, 5, 5, 6, 6, 6, 7, 7,
|
3, 3, 4, 4, 5, 5, 5, 6, 6, 7,
|
||||||
8, 8, 9, 9, 9, 10, 10, 11, 11, 12,
|
7, 7, 8, 8, 9, 9, 9, 10, 10, 11,
|
||||||
12, 12, 13, 13, 14, 14, 15, 15, 16, 16,
|
11, 11, 12, 12, 13, 13, 14, 14, 14, 15,
|
||||||
17, 17, 17, 18, 18, 19, 19, 20, 20, 21,
|
15, 16, 16, 17, 17, 18, 18, 18, 19, 19,
|
||||||
21, 21, 22, 22, 23, 23, 24, 24, 25, 25,
|
20, 20, 21, 21, 21, 22, 22, 23, 23, 24,
|
||||||
26, 26, 27, 27, 27, 28, 28, 29, 29, 30,
|
24, 25, 25, 26, 26, 26, 27, 27, 28, 28,
|
||||||
30, 31, 31, 32, 32, 32, 33, 33, 34, 34,
|
29, 29, 30, 30, 30, 31, 31, 32, 32, 33,
|
||||||
35, 35, 36, 36, 37, 37, 38, 38, 39, 39,
|
33, 34, 34, 35, 35, 35, 36, 36, 37, 37,
|
||||||
39, 40, 40, 41, 41, 42, 42, 43, 43, 44,
|
38, 38, 39, 39, 40, 40, 40, 41, 41, 42,
|
||||||
44, 45, 45, 46, 46, 46, 47, 47, 48, 48,
|
42, 43, 43, 44, 44, 45, 45, 46, 46, 46,
|
||||||
49, 49, 50, 50, 51, 51, 52, 52, 53, 53,
|
47, 47, 48, 48, 49, 49, 50, 50, 51, 51,
|
||||||
54, 54, 54, 55, 55, 56, 56, 57, 57, 58
|
52, 52, 52, 53, 53, 54, 54, 55, 55, 56
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
@ -260,7 +260,7 @@ RGR_FindBestRegression
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
assert(n <= MAX_POINTS);
|
assert(n <= MAX_POINTS);
|
||||||
assert(n * REGRESS_RUNS_RATIO < sizeof (critical_runs10) / sizeof (critical_runs10[0]));
|
assert(n * REGRESS_RUNS_RATIO < sizeof (critical_runs) / sizeof (critical_runs[0]));
|
||||||
|
|
||||||
if (n < MIN_SAMPLES_FOR_REGRESS) {
|
if (n < MIN_SAMPLES_FOR_REGRESS) {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -300,7 +300,7 @@ RGR_FindBestRegression
|
||||||
/* Count number of runs */
|
/* Count number of runs */
|
||||||
nruns = n_runs_from_residuals(resid, n - resid_start);
|
nruns = n_runs_from_residuals(resid, n - resid_start);
|
||||||
|
|
||||||
if (nruns > critical_runs10[n - resid_start] || n - start <= MIN_SAMPLES_FOR_REGRESS) {
|
if (nruns > critical_runs[n - resid_start] || n - start <= MIN_SAMPLES_FOR_REGRESS) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
/* Try dropping one sample at a time until the runs test passes. */
|
/* Try dropping one sample at a time until the runs test passes. */
|
||||||
|
@ -637,7 +637,7 @@ RGR_FindBestRobustRegression
|
||||||
|
|
||||||
nruns = n_runs_from_residuals(resids + start, n_points);
|
nruns = n_runs_from_residuals(resids + start, n_points);
|
||||||
|
|
||||||
if (nruns > critical_runs10[n_points]) {
|
if (nruns > critical_runs[n_points]) {
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
start++;
|
start++;
|
||||||
|
|
Loading…
Reference in a new issue