V. Statistics

41. Statistics

Write data as data(…): separate the values by semicolons, spaces or new lines (data(1.5 2.5 3)). A table – a row per observation, a column per variable – goes row by row separated by semicolons; the first row may hold the variables' names. More conveniently: the grid key on the f(x) tab opens a table to fill in, paste into from the clipboard (cells from Excel or Google Sheets) or load from a CSV file, and the "As data" button inserts it for statistics – even a table bigger than the grid.

For one variable, a chip picks what to compute. Descriptive statistics: the arithmetic mean, the median, the mode, the quartiles (the medians of the lower and upper half), the range and the interquartile range, the sample (n − 1) and population (n) variance and standard deviation, the coefficient of variation and the outliers (outside Q₁ − 1.5·IQR and Q₃ + 1.5·IQR), with a box plot. Frequencies and histogram: the table of absolute, relative and cumulative frequencies – by values for whole numbers with few values, by classes otherwise (their count by Sturges' rule). z-scores: each value standardized by the data's mean and standard deviation, with its T-score.

Two variables (two columns) give correlation and regression: the sums, the covariance, Pearson's correlation coefficient r with the strength of the relationship in words, the least-squares regression line and the coefficient of determination r², with a scatter plot. Three or more variables get their descriptive statistics side by side with box plots.

Statistical inference from data: the confidence interval of the mean (chip “Confidence interval of the mean”, 90, 95 or 99 %) by the t distribution; the t-test (chip “t-test”) – one variable against the tested value μ₀, two variables as independent samples (Welch's test, or with equal variances) or paired values (the pairs' differences); the χ² test (chip “χ² test”) – one column of counts as a goodness-of-fit test to a uniform distribution, a table as a test of independence with Cramér's V. Under the chips you enter the significance level α, the alternative (two-sided, left-sided, right-sided) and μ₀. The steps: the hypotheses, the test statistic, the critical value and region, the p-value and the decision; the graph shows the distribution with the critical region shaded. Write two independent samples of different sizes as named columns – data(A = 23 25 28; B = 20 22 21 25).

Comparing groups: the chip "Rank test (Mann–Whitney, Wilcoxon, Kruskal–Wallis)" compares two groups by the Mann–Whitney test (with "Paired" paired values by Wilcoxon's test) and three or more groups by the Kruskal–Wallis test – by the values' ranks, without assuming a normal distribution; for small samples without ties the p-value is exact. The chip "ANOVA (analysis of variance)" compares the groups' means by one-way analysis of variance with the ANOVA table, the F-test and the effect size η². Write the groups in columns, of any lengths (named columns); the graph shows the groups' box plots and the test statistic's distribution. For the χ² test of one column of counts, the field "Expected shares" takes your own expected shares – 1:2:1, 0.25 0.5 0.25 or in percent.

The regression of two variables has a model choice under its chip: linear (with the test of the correlation's significance), quadratic (the least squares normal equations), exponential y = a·e^(bx), power y = a·x^b and logarithmic y = a + b·ln x (by linearization through logarithms) – with the coefficient of determination R² and a graph of the fitted curve. The “Statistics and psychometrics” form also has the confidence interval and t-tests from summary values (size, mean, standard deviation) – including the z-test with a known σ and the two-sample t-test.

The normal distribution is in the "Statistics and psychometrics" form (the "Applications" section of the home screen, the Statistics field): the probabilities P(X < x), P(X > x), P(a < X < b) and the quantile – the value below which a given share lies. The steps standardize, z = (x − μ)/σ, and use the distribution function Φ, a negative z as 1 − Φ(|z|) as in the tables; the graph shows the density with the area shaded.

How to enter it

data(3; 5; 7; 7; 9)One variable – the values by semicolons, spaces or one under another.
data(x y; 1 52; 2 58; 3 61)A table row by row, the first row the variables' names (optional).
data(x = 1 2 3 4; y = 2 4 5 4)Named columns, each with its values.

Examples

Descriptive statistics of eight values.
Input: data(2; 4; 4; 4; 5; 5; 7; 9)
data(2; 4; 4; 4; 5; 5; 7; 9)
data(2; 4; 4; 4; 5; 5; 7; 9)data(2; 4; 4; 4; 5; 5; 7; 9)
The outlier 31 in the box plot.
Input: data(12 15 14 13 16 15 14 31)
data(12 15 14 13 16 15 14 31)
data(12 15 14 13 16 15 14 31)data(12 15 14 13 16 15 14 31)
The frequency table of grades and its histogram.
Input: data(1 2 2 3 3 3 3 4 4 5 1 3 2 4 3) Frequencies and histogram
data(1 2 2 3 3 3 3 4 4 5 1 3 2 4 3)
data(1 2 2 3 3 3 3 4 4 5 1 3 2 4 3)data(1 2 2 3 3 3 3 4 4 5 1 3 2 4 3)
Continuous data grouped into classes.
Input: data(12.5 14.1 15.8 17.2 18.9 21.3 22.0 23.7 25.1 26.4 28.8 31.2) Frequencies and histogram
data(12.5 14.1 15.8 17.2 18.9 21.3 22.0 23.7 25.1 26.4 28.8 31.2)
data(12.5 14.1 15.8 17.2 18.9 21.3 22.0 23.7 25.1 26.4 28.8 31.2)data(12.5 14.1 15.8 17.2 18.9 21.3 22.0 23.7 25.1 26.4 28.8 31.2)
The values' z-scores and T-scores.
Input: data(2 4 4 4 5 5 7 9) z-scores
data(2 4 4 4 5 5 7 9)
data(2 4 4 4 5 5 7 9)data(2 4 4 4 5 5 7 9)
Correlation and the regression line – hours of study and test points.
Input: data(x y; 1 52; 2 58; 3 61; 4 70; 5 74; 6 79)
data(x y; 1 52; 2 58; 3 61; 4 70; 5 74; 6 79)
data(x y; 1 52; 2 58; 3 61; 4 70; 5 74; 6 79)data(x y; 1 52; 2 58; 3 61; 4 70; 5 74; 6 79)
Three variables side by side.
Input: data(A B C; 12 15 9; 14 18 11; 11 16 10; 15 19 12; 13 17 10)
data(A B C; 12 15 9; 14 18 11; 11 16 10; 15 19 12; 13 17 10)
data(A B C; 12 15 9; 14 18 11; 11 16 10; 15 19 12; 13 17 10)data(A B C; 12 15 9; 14 18 11; 11 16 10; 15 19 12; 13 17 10)
95% confidence interval of the mean of ten measurements.
Input: data(102 98 110 105 99 107 101 104 96 108) Confidence interval of the mean
data(102 98 110 105 99 107 101 104 96 108)
Does the mean differ from 100? One-sample t-test.
Input: data(102 98 110 105 99 107 101 104 96 108) t-test
data(102 98 110 105 99 107 101 104 96 108)
data(102 98 110 105 99 107 101 104 96 108)data(102 98 110 105 99 107 101 104 96 108)
Two independent samples of different sizes – Welch's t-test.
Input: data(A = 23 25 28 30 26 27; B = 20 22 21 25 19 24 23) t-test
data(A = 23 25 28 30 26 27; B = 20 22 21 25 19 24 23)
data(A = 23 25 28 30 26 27; B = 20 22 21 25 19 24 23)data(A = 23 25 28 30 26 27; B = 20 22 21 25 19 24 23)
Paired t-test – measurements before and after.
Input: data(x1 x2; 72 70; 75 73; 68 69; 80 76; 77 74; 74 71) t-test · Paired
data(x1 x2; 72 70; 75 73; 68 69; 80 76; 77 74; 74 71)
data(x1 x2; 72 70; 75 73; 68 69; 80 76; 77 74; 74 71)data(x1 x2; 72 70; 75 73; 68 69; 80 76; 77 74; 74 71)
Is the die fair? χ² goodness-of-fit test.
Input: data(8 12 9 11 6 14) χ² test
data(8 12 9 11 6 14)
data(8 12 9 11 6 14)data(8 12 9 11 6 14)
Test of independence in a 2×2 table.
Input: data(20 30; 25 15) χ² test
data(20 30; 25 15)
data(20 30; 25 15)data(20 30; 25 15)
Two groups by the Mann–Whitney test – small samples, an exact p-value.
Input: data(A = 23 25 28 30 26 27; B = 20 22 21 25 19 24 23) Rank test (Mann–Whitney, Wilcoxon, Kruskal–Wallis)
data(A = 23 25 28 30 26 27; B = 20 22 21 25 19 24 23)
data(A = 23 25 28 30 26 27; B = 20 22 21 25 19 24 23)data(A = 23 25 28 30 26 27; B = 20 22 21 25 19 24 23)
Paired values before and after by Wilcoxon's test.
Input: data(pred po; 72 70; 75 73; 68 69; 80 76; 77 74; 74 71; 79 72) Rank test (Mann–Whitney, Wilcoxon, Kruskal–Wallis) · Paired
data(pred po; 72 70; 75 73; 68 69; 80 76; 77 74; 74 71; 79 72)
data(pred po; 72 70; 75 73; 68 69; 80 76; 77 74; 74 71; 79 72)data(pred po; 72 70; 75 73; 68 69; 80 76; 77 74; 74 71; 79 72)
Three groups by the Kruskal–Wallis test.
Input: data(A = 12 15 14 11 13; B = 16 18 17 15 19; C = 13 14 12 16 15) Rank test (Mann–Whitney, Wilcoxon, Kruskal–Wallis)
data(A = 12 15 14 11 13; B = 16 18 17 15 19; C = 13 14 12 16 15)
data(A = 12 15 14 11 13; B = 16 18 17 15 19; C = 13 14 12 16 15)data(A = 12 15 14 11 13; B = 16 18 17 15 19; C = 13 14 12 16 15)
Three groups' means by one-way ANOVA.
Input: data(A = 12 15 14 11 13; B = 16 18 17 15 19; C = 13 14 12 16 15) ANOVA (analysis of variance)
data(A = 12 15 14 11 13; B = 16 18 17 15 19; C = 13 14 12 16 15)
data(A = 12 15 14 11 13; B = 16 18 17 15 19; C = 13 14 12 16 15)data(A = 12 15 14 11 13; B = 16 18 17 15 19; C = 13 14 12 16 15)
A goodness-of-fit test against the expected shares 1 : 2 : 1.
Input: data(30 50 20) χ² test · Expected shares 1:2:1
data(30 50 20)
data(30 50 20)data(30 50 20)
Quadratic regression.
Input: data(x y; 1 2.1; 2 3.9; 3 9.2; 4 15.8; 5 25.1; 6 36.2) Correlation and regression · Quadratic
data(x y; 1 2.1; 2 3.9; 3 9.2; 4 15.8; 5 25.1; 6 36.2)
data(x y; 1 2.1; 2 3.9; 3 9.2; 4 15.8; 5 25.1; 6 36.2)data(x y; 1 2.1; 2 3.9; 3 9.2; 4 15.8; 5 25.1; 6 36.2)
Exponential regression by linearization.
Input: data(x y; 0 2.0; 1 2.7; 2 3.7; 3 5.0; 4 6.8; 5 9.1) Correlation and regression · Exponential
data(x y; 0 2.0; 1 2.7; 2 3.7; 3 5.0; 4 6.8; 5 9.1)
data(x y; 0 2.0; 1 2.7; 2 3.7; 3 5.0; 4 6.8; 5 9.1)data(x y; 0 2.0; 1 2.7; 2 3.7; 3 5.0; 4 6.8; 5 9.1)
Right-sided t-test from summary values: n = 25, x̄ = 104, s = 15, μ₀ = 100.
Input: model(ttest; find=test[one]; n=25[one]; mean=104[one]; sd=15[one]; mu0=100[one]; alpha=0.05[one]; alternative=greater; sigma=sample)
model(ttest; find=test[one]; n=25[one]; mean=104[one]; sd=15[one]; mu0=100[one]; alpha=0.05[one]; alternative=greater; sigma=sample)
model(ttest; find=test[one]; n=25[one]; mean=104[one]; sd=15[one]; mu0=100[one]; alpha=0.05[one]; alternative=greater; sigma=sample)model(ttest; find=test[one]; n=25[one]; mean=104[one]; sd=15[one]; mu0=100[one]; alpha=0.05[one]; alternative=greater; sigma=sample)
Welch's t-test of two groups from summary values.
Input: model(twosample; find=test[one]; n1=30[one]; mean1=52[one]; sd1=8[one]; n2=28[one]; mean2=47[one]; sd2=10[one]; alpha=0.05[one]; variances=welch; alternative=two)
model(twosample; find=test[one]; n1=30[one]; mean1=52[one]; sd1=8[one]; n2=28[one]; mean2=47[one]; sd2=10[one]; alpha=0.05[one]; variances=welch; alternative=two)
model(twosample; find=test[one]; n1=30[one]; mean1=52[one]; sd1=8[one]; n2=28[one]; mean2=47[one]; sd2=10[one]; alpha=0.05[one]; variances=welch; alternative=two)model(twosample; find=test[one]; n1=30[one]; mean1=52[one]; sd1=8[one]; n2=28[one]; mean2=47[one]; sd2=10[one]; alpha=0.05[one]; variances=welch; alternative=two)
The normal distribution: P(X < 85) for N(100; 15²).
Input: model(normal; find=below[one]; mu=100[one]; sigma=15[one]; x=85[one])
model(normal; find=below[one]; mu=100[one]; sigma=15[one]; x=85[one])
model(normal; find=below[one]; mu=100[one]; sigma=15[one]; x=85[one])model(normal; find=below[one]; mu=100[one]; sigma=15[one]; x=85[one])
The share of people between 160 and 185 cm tall with μ = 170, σ = 8.
Input: model(normal; find=between[one]; mu=170[one]; sigma=8[one]; a=160[one]; b=185[one])
model(normal; find=between[one]; mu=170[one]; sigma=8[one]; a=160[one]; b=185[one])
model(normal; find=between[one]; mu=170[one]; sigma=8[one]; a=160[one]; b=185[one])model(normal; find=between[one]; mu=170[one]; sigma=8[one]; a=160[one]; b=185[one])
A quantile: the score below which 95 % of the population lie.
Input: model(normal; find=quantile[one]; mu=100[one]; sigma=15[one]; p=95[pct])
model(normal; find=quantile[one]; mu=100[one]; sigma=15[one]; p=95[pct])
model(normal; find=quantile[one]; mu=100[one]; sigma=15[one]; p=95[pct])model(normal; find=quantile[one]; mu=100[one]; sigma=15[one]; p=95[pct])

Known limitations