Goodness-of-fit tests: normal distribution (Lilliefors) and uniform distribution (χ²)
In brief
In "How is something distributed?" under the result: does the distribution fit an expectation? For number columns Statable tests the normal distribution with two tests (Shapiro-Wilk and Lilliefors), for columns with categories the χ² goodness-of-fit test against a uniform distribution or against own proportions fixed beforehand.
Normal distribution: Lilliefors
- Lilliefors is the Kolmogorov-Smirnov test with mean and standard deviation estimated from the data (Lilliefors 1967). The ordinary Kolmogorov-Smirnov test that takes these values from the data is then too cautious: its p is too large. So Statable never shows the p of the Kolmogorov-Smirnov output of PSPP (NPAR TESTS /K-S) but the corrected p after Lilliefors.
- As with Shapiro-Wilk, it is calculated for number columns with more than 12 different values (and at least 5 valid values); with only a few different values a normality test says little, so there is none, and the Q-Q plot shows more. The p is the well-known approximation (Dallal and Wilkinson 1986) as in R (nortest::lillie.test). With constant values there is no test.
- As with Shapiro-Wilk: p < .05 means the distribution departs; p ≥ .05 only means that the test does not speak against it - never "is normally distributed". With few people it misses large departures, with many it flags even small ones; the Q-Q plot shows more. Shapiro-Wilk is usually more powerful for small and medium samples.
Categories: χ² goodness-of-fit test
- It compares the observed frequencies with the expected ones, only for categories (text, value labels, level of measurement nominal or ordinal), never for metric number columns with few values. Default: uniform distribution (every category equally often). Own proportions are available with "Expect own proportions instead of a uniform distribution": a proportion or weight for each category, the numbers are scaled to a sum of 1. They must be fixed before the analysis (theory, previous study, Mendel), not taken from these data. The test is only calculated with "Fix the proportions and calculate", not with every keystroke; sentence and APA line name the proportions ("against proportions fixed beforehand 40 : 30 : 20 : 10"). If they are changed again after a result, the note comes first that the p value then no longer counts as a test of an assumption fixed beforehand.
- Cochran rule (1954): if fewer than 1 is expected in a category or fewer than 5 in more than 20% of the categories, the test is inaccurate and Statable says that the p is uncertain. There is no exact test here; rare categories can be combined. A category without observations counts.
- Two categories: without continuity correction, as R chisq.test(x, p). A non-significant result does not show a uniform distribution.
- The standardized residuals (table) show which category deviates most: noticeable from about ±2.
Reporting the result
Lilliefors D = .241, p = .003; χ²(3, N = 556) = 0.47, p = .925
Example (Mendel's peas, 315 : 108 : 101 : 32 against 9 : 3 : 3 : 1): χ²(3, N = 556) = 0.47, p = .925. The data do not speak against the expected proportions; that does not show that the theory is right.
For specialists
Lilliefors: D = largest deviation of the empirical from the normal distribution function with the mean and SD (n − 1) of the data; p after the approximation of nortest::lillie.test (Dallal and Wilkinson 1986; Stephens), unchanged. For n > 100, D is converted to n = 100. PSPP NPAR TESTS /K-S(NORMAL) gives the same D but a p without correction (check in the test). Goodness of fit: Σ (O − E)²/E with k − 1 degrees of freedom, as R chisq.test(x, p, rescale.p = TRUE); PSPP NPAR TESTS /CHISQUARE gives the same numbers.
Sources
Lilliefors, H. W. (1967). On the Kolmogorov-Smirnov test for normality with mean and variance unknown. Journal of the American Statistical Association, 62, 399-402. Dallal, G. E. & Wilkinson, L. (1986). An analytic approximation to the distribution of Lilliefors's test statistic for normality. The American Statistician, 40, 294-296. Cochran, W. G. (1954). Some methods for strengthening the common χ² tests. Biometrics, 10, 417-451.