Stat Analysis

An interactive pairwise matrix that maps associations across all selected variables and provides detailed statistical tests on demand.

Overview

The Stat Analysis feature computes a pairwise association measure for every combination of your selected variables and displays the results as a colour-coded matrix. Each cell shows a summary statistic whose type depends on the variable pair:

Clicking any cell opens a detailed modal with the full battery of relevant statistical tests, effect sizes, confidence intervals, and an automatically generated plain-language interpretation. The matrix uses sticky headers so that row and column labels remain visible when scrolling through large datasets, and a progress bar is displayed during computation for datasets with many variables.

Worked Example

Scenario: Agricultural Field Trial

An agronomist has a CSV with 150 plot records containing Yield (kg/ha, numeric), Rainfall (mm, numeric), SoilpH (numeric), FertilizerType (Organic, Chemical, None), and Region (North, South, East, West). They want a quick overview of which variables are associated with each other.

Using Statulator:

1 Open Dataset Analysis and load the CSV.

2 Click Select Variables, verify types, select all five variables, and click Save Changes.

3 Click the green Stat Analysis button.

4 A progress bar appears while the matrix is computed. Once complete, the 5 × 5 association matrix is displayed with colour-coded cells.

5 Hover over any cell to see a tooltip with variable names, types, and available analyses. Click the cell (e.g., Yield × FertilizerType) to open the detailed analysis modal.

What you will see in the modal (Yield × FertilizerType, Num × Cat):

The modal displays an independent two-sample t-test (if 2 groups) or one-way ANOVA (if 3+ groups), plus non-parametric alternatives (Mann-Whitney U or Kruskal-Wallis), Levene’s test for equality of variances, effect sizes (Cohen’s d or η²), and an auto-generated interpretation paragraph.

Interpretation Guide

Reading the Matrix

Darker, more saturated cell colours indicate stronger associations. The diagonal is always 1.0 (a variable is perfectly associated with itself). Look for off-diagonal cells with high absolute values to identify the strongest relationships in your data.

Num × Num: Correlation & Regression

The modal presents both Pearson r (linear association) and Spearman ρ (monotonic association). If they diverge substantially, the relationship may be non-linear. The simple linear regression section provides the fitted equation, R², and a 95 % prediction band. The Shapiro-Wilk test checks normality of the residuals, a key assumption of the parametric tests. Common strength labels: |r| < 0.3 weak, 0.3–0.7 moderate, > 0.7 strong.

Cat × Cat: Chi-square & Association

The chi-square test of independence tells you whether the two categorical variables are associated. Cramér’s V quantifies the strength (0 = no association, 1 = perfect). For 2 × 2 tables, the odds ratio (OR) and relative risk (RR) with 95 % CIs are also provided, alongside Fisher’s exact test for small expected cell counts. Check the note about cells with expected count < 5; if too many exist, Fisher’s exact test is more reliable.

Num × Cat: Group Comparisons

When comparing a numeric variable across categorical groups: for 2 groups, the two-sample t-test (pooled and Welch) and Mann-Whitney U test are shown with Cohen’s d and the mean difference with 95 % CI. For 3+ groups, one-way ANOVA and Kruskal-Wallis replace them, with η² as the effect size. Levene’s test checks whether group variances are equal; if it is significant, prefer the Welch t-test (2 groups) or note the ANOVA assumption violation (3+ groups).

Auto-Interpretation

At the bottom of each modal, Statulator generates a plain-language summary. It reports the direction and strength of the relationship, statistical significance, key effect sizes, assumption checks, and recommendations for non-parametric alternatives when assumptions are violated. This is a starting point; always review the raw numbers and consider the context of your study.

Formulas

Num × Num Tests
Pearson Correlation & Confidence Interval
\[ r = \frac{\sum(x_i - \bar{x})(y_i - \bar{y})}{\sqrt{\sum(x_i - \bar{x})^2\,\sum(y_i - \bar{y})^2}} \]

95 % CI via Fisher z-transform:

\[ z = \tfrac{1}{2}\ln\!\left(\frac{1+r}{1-r}\right),\quad \text{SE}_z = \frac{1}{\sqrt{n-3}} \] \[ z_{\text{lower,upper}} = z \pm 1.96\,\text{SE}_z, \quad r_{\text{lower,upper}} = \frac{e^{2z_*}-1}{e^{2z_*}+1} \]
Spearman Rank Correlation
\[ \rho = 1 - \frac{6\sum d_i^2}{n(n^2 - 1)} \]
  • \(d_i\) = difference in ranks for observation \(i\).
Simple Linear Regression (OLS)
\[ \hat{y} = b_0 + b_1 x, \quad b_1 = \frac{\sum(x_i - \bar{x})(y_i - \bar{y})}{\sum(x_i - \bar{x})^2}, \quad b_0 = \bar{y} - b_1\bar{x} \] \[ R^2 = \frac{\text{SSR}}{\text{SST}} = 1 - \frac{\text{SSE}}{\text{SST}}, \quad F = \frac{\text{MSR}}{\text{MSE}} \]
Shapiro-Francia Normality Test
\[ W' = \frac{\left(\sum_{i=1}^{n}(x_{(i)} - \bar{x})(m_i - \bar{m})\right)^2}{\sum_{i=1}^{n}(x_i - \bar{x})^2\;\sum_{i=1}^{n}(m_i - \bar{m})^2} \]
  • \(x_{(i)}\) = \(i\)-th order statistic;   \(m_i = \Phi^{-1}\!\bigl((i - 3/8)/(n + 1/4)\bigr)\) = expected normal score.
  • P-value via Royston (1993). Closely related to Shapiro-Wilk; agrees to within ~0.01 for typical samples.
  • For \(n > 5000\), Statulator uses the D’Agostino-Pearson omnibus test instead.

Cat × Cat Tests
Chi-Square Test of Independence
\[ \chi^2 = \sum_{i}\sum_{j} \frac{(O_{ij} - E_{ij})^2}{E_{ij}}, \quad E_{ij} = \frac{n_{i\cdot}\,n_{\cdot j}}{N} \]
  • \(\text{df} = (r-1)(c-1)\);   \(r\) = rows, \(c\) = columns.
Cramér’s V
\[ V = \sqrt{\frac{\chi^2}{N\,(\min(r,c)-1)}} \]
Odds Ratio & Relative Risk (2 × 2)
\[ \text{OR} = \frac{a \cdot d}{b \cdot c}, \quad \text{RR} = \frac{a/(a+b)}{c/(c+d)} \]

95 % CIs computed via log-transform: \(\ln(\text{OR}) \pm 1.96\sqrt{1/a+1/b+1/c+1/d}\).

Fisher’s Exact Test (2 × 2)
\[ p = \frac{\binom{a+b}{a}\binom{c+d}{c}}{\binom{N}{a+c}} \]

Two-sided p-value is the sum of all table probabilities ≤ the observed probability.


Num × Cat Tests
Eta (η) Correlation Ratio
\[ \eta = \sqrt{\frac{\text{SS}_{\text{between}}}{\text{SS}_{\text{total}}}}, \quad \eta^2 = \frac{\sum_{j} n_j(\bar{x}_j - \bar{x})^2}{\sum_{i}(x_i - \bar{x})^2} \]
  • \(\bar{x}_j\) = mean of group \(j\);   \(n_j\) = group size;   \(\bar{x}\) = grand mean.
Two-Sample t-Test

Pooled:

\[ t = \frac{\bar{x}_1 - \bar{x}_2}{s_p\sqrt{1/n_1 + 1/n_2}}, \quad s_p = \sqrt{\frac{(n_1-1)s_1^2 + (n_2-1)s_2^2}{n_1+n_2-2}} \]

Welch:

\[ t = \frac{\bar{x}_1 - \bar{x}_2}{\sqrt{s_1^2/n_1 + s_2^2/n_2}}, \quad \text{df} = \frac{(s_1^2/n_1 + s_2^2/n_2)^2}{\frac{(s_1^2/n_1)^2}{n_1-1} + \frac{(s_2^2/n_2)^2}{n_2-1}} \]
Cohen’s d
\[ d = \frac{\bar{x}_1 - \bar{x}_2}{s_p} \]

Small ≈ 0.2, Medium ≈ 0.5, Large ≈ 0.8 (Cohen, 1988).

One-Way ANOVA
\[ F = \frac{\text{MSB}}{\text{MSW}} = \frac{\text{SS}_B/(k-1)}{\text{SS}_W/(N-k)} \]
  • \(k\) = number of groups;   \(N\) = total observations.
  • \(\eta^2 = \text{SS}_B / \text{SS}_T\) used as effect size.
Mann-Whitney U Test
\[ U = n_1 n_2 + \frac{n_1(n_1+1)}{2} - R_1 \]
  • \(R_1\) = sum of ranks in group 1.   Z-approximation: \(Z = \frac{U - n_1 n_2/2}{\sqrt{n_1 n_2(n_1+n_2+1)/12}}\).
Kruskal-Wallis H Test
\[ H = \frac{12}{N(N+1)}\sum_{j=1}^{k}\frac{R_j^2}{n_j} - 3(N+1) \]
  • \(R_j\) = sum of ranks in group \(j\);   compared to \(\chi^2\) distribution with \(k-1\) df.
Levene’s Test (Median-Based)
\[ W = \frac{(N-k)\sum_{j} n_j(\bar{z}_{j\cdot} - \bar{z}_{\cdot\cdot})^2}{(k-1)\sum_{j}\sum_{i}(z_{ij} - \bar{z}_{j\cdot})^2} \]
  • \(z_{ij} = |x_{ij} - \widetilde{x}_j|\) where \(\widetilde{x}_j\) is the group median. Compared to \(F_{k-1,\,N-k}\).

Assumptions & Requirements

Textbook Examples

Medicine

Association matrix for a clinical dataset with Age (numeric), BMI (numeric), Smoker (categorical), and Diabetes (categorical).

Key findings: Age × BMI: Pearson r = 0.32 (weak positive). Smoker × Diabetes: χ² = 9.8, p = 0.002, Cramér's V = 0.18. BMI × Diabetes: t-test p < 0.001, Cohen's d = 0.65.
Interpretation: The matrix quickly identifies BMI as the strongest numeric predictor of diabetes status, while smoking is also significantly associated.

Education

Association matrix for student data: GPA (numeric), Study Hours (numeric), Major (4 categories), Scholarship (yes/no).

Key findings: GPA × Study Hours: r = 0.55. GPA × Scholarship: t-test p < 0.001, d = 0.91. Major × Scholarship: χ² = 12.4, p = 0.006.
Interpretation: Scholarship holders have substantially higher GPAs (large effect). Study hours are moderately correlated with GPA. Scholarship rates differ across majors.

Agriculture

Association matrix for a field trial: Yield (numeric), Rainfall (numeric), Soil Type (3 categories), Fertilizer (2 categories).

Key findings: Yield × Rainfall: r = 0.68. Yield × Fertilizer: t-test p = 0.003, d = 0.52. Yield × Soil Type: ANOVA p < 0.001, η² = 0.22.
Interpretation: Soil type explains the most variance in yield (η² = 0.22), followed by rainfall. The new fertilizer also contributes a medium-sized effect.

Social Science

Association matrix for a labour survey: Income (numeric), Years of Experience (numeric), Gender (2 categories), Industry (5 categories).

Key findings: Income × Experience: r = 0.61. Income × Gender: Welch t-test p < 0.001, d = 0.45. Income × Industry: Kruskal-Wallis p < 0.001.
Interpretation: Experience is the strongest linear predictor of income. The gender pay gap has a medium effect size. Income distributions vary significantly across industries (non-parametric test used due to heavy skew).

References

  1. Pearson, K. (1895). Note on regression and inheritance in the case of two parents. Proceedings of the Royal Society of London, 58, 240–242.
  2. Spearman, C. (1904). The proof and measurement of association between two things. American Journal of Psychology, 15(1), 72–101.
  3. Shapiro, S. S., & Wilk, M. B. (1965). An analysis of variance test for normality. Biometrika, 52(3/4), 591–611.
  4. Royston, P. (1995). Remark AS R94: A remark on algorithm AS 181. Applied Statistics, 44(4), 547–551.
  5. Pearson, K. (1900). On the criterion that a given system of deviations can be reasonably supposed to have arisen from random sampling. Philosophical Magazine, 50(302), 157–175.
  6. Fisher, R. A. (1922). On the interpretation of χ² from contingency tables. Journal of the Royal Statistical Society, 85(1), 87–94.
  7. Cramér, H. (1946). Mathematical Methods of Statistics. Princeton University Press.
  8. Student (1908). The probable error of a mean. Biometrika, 6(1), 1–25.
  9. Welch, B. L. (1947). The generalization of Student’s problem when several different population variances are involved. Biometrika, 34(1/2), 28–35.
  10. Cohen, J. (1988). Statistical Power Analysis for the Behavioral Sciences (2nd ed.). Lawrence Erlbaum.
  11. Mann, H. B., & Whitney, D. R. (1947). On a test of whether one of two random variables is stochastically larger than the other. Annals of Mathematical Statistics, 18(1), 50–60.
  12. Kruskal, W. H., & Wallis, W. A. (1952). Use of ranks in one-criterion variance analysis. Journal of the American Statistical Association, 47(260), 583–621.
  13. Levene, H. (1960). Robust tests for equality of variances. In I. Olkin (Ed.), Contributions to Probability and Statistics (pp. 278–292). Stanford University Press.