diff options
author | Colin Percival <cperciva@FreeBSD.org> | 2016-11-05 06:33:39 +0000 |
---|---|---|
committer | Colin Percival <cperciva@FreeBSD.org> | 2016-11-05 06:33:39 +0000 |
commit | a304ad90e9ae16b7b4e135e84fc347d8bdd844af (patch) | |
tree | ecbd0e75459d9d58df2f03595ddbf5f4cc912d79 /usr.bin/ministat | |
parent | b780b03cbefa2bcbc9a39005e8544aeb304554a1 (diff) | |
download | src-a304ad90e9ae16b7b4e135e84fc347d8bdd844af.tar.gz src-a304ad90e9ae16b7b4e135e84fc347d8bdd844af.zip |
Notes
Diffstat (limited to 'usr.bin/ministat')
-rw-r--r-- | usr.bin/ministat/ministat.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.bin/ministat/ministat.c b/usr.bin/ministat/ministat.c index a7f7182ce420..02b5025a436c 100644 --- a/usr.bin/ministat/ministat.c +++ b/usr.bin/ministat/ministat.c @@ -232,6 +232,7 @@ static void Relative(struct dataset *ds, struct dataset *rs, int confidx) { double spool, s, d, e, t; + double re; int i; i = ds->n + rs->n - 2; @@ -246,11 +247,16 @@ Relative(struct dataset *ds, struct dataset *rs, int confidx) d = Avg(ds) - Avg(rs); e = t * s; + re = (ds->n - 1) * Var(ds) + (rs->n - 1) * Var(rs) * + (Avg(ds) * Avg(ds)) / (Avg(rs) * Avg(rs)); + re *= (ds->n + rs->n) / (ds->n * rs->n * (ds->n + rs->n - 2.0)); + re = t * sqrt(re); + if (fabs(d) > e) { printf("Difference at %.1f%% confidence\n", studentpct[confidx]); printf(" %g +/- %g\n", d, e); - printf(" %g%% +/- %g%%\n", d * 100 / Avg(rs), e * 100 / Avg(rs)); + printf(" %g%% +/- %g%%\n", d * 100 / Avg(rs), re * 100 / Avg(rs)); printf(" (Student's t, pooled s = %g)\n", spool); } else { printf("No difference proven at %.1f%% confidence\n", |