diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2019-05-17 10:16:19 +0100 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2019-05-17 10:16:19 +0100 |
commit | ebdea3242694e7ff70e018b95663d6b463b22922 (patch) | |
tree | 99c1eae36e2e2ab1912642e3a47284f4df63f36d | |
parent | 3d0c1991fdb19211d33653c3ba8e69364d1d6927 (diff) |
t
-rw-r--r-- | ministat.c | 18 |
1 files changed, 14 insertions, 4 deletions
@@ -379,10 +379,20 @@ Relative(struct dataset *ds, struct dataset *rs, int confidx) double p = 100 *(1 - pvalue(welch(ds, rs), dof(ds, rs))); if (p > studentpct[confidx]) { - printf("Difference at %.1f%% confidence: %g (%.2f%%)\n", - p, - Avg(ds) - Avg(rs), - (Avg(ds) - Avg(rs)) / Avg(ds) * 100); + double c, d; + int v; + + d = Avg(ds) - Avg(rs); + + v = dof(ds, rs); + if (v > NSTUDENT) + c = student[0][confidx]; + else + c = student[v][confidx]; + c *= sqrt(Var(ds)/ds->n - Var(rs)/rs->n); + + printf("Difference at %.1f%% confidence: %g +- %g (%.2f%% +- %.3f%%)\n", p, + d, c, d / Avg(ds) * 100, c / Avg(ds) * 1000); } } |