statable Statistics for study and research

Calculate from summary numbers: interval, test and sample size

In brief

If only the numbers are available (a count x out of n, or mean, standard deviation and n), this tile calculates the confidence interval and the test. It also answers how large the sample must be for an interval of a desired width.

Proportion

Why does the textbook differ?

Many textbooks use the approximation formula p̂ ± z · √(p̂ (1 − p̂) / n) (Wald). It is inaccurate for small n or for proportions near 0 and 1 and can even exceed 1. Wilson solves the underlying inequality exactly. Example 7 of 40, 95%: textbook formula 0.0572 to 0.2928, Wilson 0.0875 to 0.3195. The number in the book is therefore not miscalculated but an approximation. (The R function prop.test applies a continuity correction by default and gives 0.0789 to 0.3336 here; Statable calculates without it.)

Mean

Standard error SE = s / √n, t = (x̄ − μ₀) / SE with n − 1 degrees of freedom, interval x̄ ± t · SE and Cohen’s d = (x̄ − μ₀) / s. Because the population standard deviation is unknown, t is used, not z. n below 2 and s = 0 are blocked, because t and d would not be defined.

Sample size for a desired width

Rates from events and person-time

For specialists

Checked against R: prop.test(x, n, p, conf.level, correct = FALSE) for interval and p value, t.test for mean, interval and p, qnorm for the sample sizes. For x = 0 the lower limit is exactly 0, for x = n the upper limit exactly 1. At p̂ = 0.5 the Wilson interval is never wider than the Wald interval.

Sources

Related

Open in Statable