Loading…

Make lmperm Output Into an ANOVA Table

How can lmperm output be converted into an ANOVA table with sources of variation, degrees of freedom, sums of squares, mean squares, F statistics, and permutation p-values?

Subject: Statistics Chapter: Analysis of Variance Topic: One Way Analysis of Variance, Calculating the Test Statistic F Answer included
make lmperm output into anova table lmperm lmPerm permutation test ANOVA table sum of squares degrees of freedom mean square
Accepted answer Answer included

Problem

The task “make lmperm output into anova table” means converting the results of a permutation-based linear model (commonly reported by lmperm) into the familiar ANOVA table layout: Source, \(df\), \(SS\), \(MS\), \(F\), and a p-value (here, a permutation p-value).

What an ANOVA table contains

An ANOVA table partitions variability into components attributed to model terms and an error (residual) component:

Source \(df\) \(SS\) \(MS\) \(F\) p-value
Term 1 (e.g., factor A) \(df_A\) \(SS_A\) \(MS_A=SS_A/df_A\) \(F_A=MS_A/MS_E\) Permutation p
Term 2 (e.g., factor B) \(df_B\) \(SS_B\) \(MS_B=SS_B/df_B\) \(F_B=MS_B/MS_E\) Permutation p
Error (Residuals) \(df_E\) \(SS_E=SSE\) \(MS_E=SS_E/df_E\)
Total \(df_T\) \(SS_T\)

Core computations behind the table

The mechanical part of making an ANOVA table is the same whether p-values come from a classical \(F\) distribution or from permutations. The difference is the final p-value column.

1) Decide which sums of squares are intended

  • Sequential (Type I): each term is tested as it enters the model; the order of terms matters.
  • Partial / marginal (common in regression): each term is tested after adjusting for the others (compare full vs reduced models).

Many permutation-model outputs correspond to comparing nested models; the nested-model method below produces a clean ANOVA-style table.

2) Use nested models to get \(SS\) for each term

Let the full model contain all terms of interest, and let \(SSE_{\text{full}}\) be its residual sum of squares. For a specific term \(j\), fit a reduced model that removes term \(j\) (but keeps all other terms), and compute \(SSE_{\text{reduced},j}\).

\[ SS_j = SSE_{\text{reduced},j} - SSE_{\text{full}} \]

The degrees of freedom for the term come from the parameter count difference: \[ df_j = df_{\text{reduced},j} - df_{\text{full}} \]

3) Compute the error row

The error (residual) sum of squares is: \[ SS_E = SSE_{\text{full}} \]

If the sample size is \(n\) and the full model has \(p\) estimated parameters (including the intercept), then: \[ df_E = n - p \]

Then: \[ MS_E = \frac{SS_E}{df_E} \]

4) Compute \(MS\) and \(F\) for each term

\[ MS_j = \frac{SS_j}{df_j} \qquad F_j = \frac{MS_j}{MS_E} \]

5) Replace classical p-values with permutation p-values

In a permutation approach, the observed statistic \(F_{j,\text{obs}}\) is compared to its permutation distribution \(F_{j}^{(1)},\dots,F_{j}^{(B)}\). A standard right-tail permutation p-value is: \[ p_j = \frac{1 + \sum_{b=1}^{B}\mathbf{1}\!\left(F_{j}^{(b)} \ge F_{j,\text{obs}}\right)}{B+1} \]

This is the key step for “make lmperm output into anova table”: keep \(SS\), \(df\), \(MS\), and \(F\) in the usual ANOVA format, but report p-values from permutations.

Visualization: how sums of squares partition variability

Partition of \(SS_T\) \(SS_{\text{term 1}}\) \(SS_{\text{term 2}}\) \(SS_E\) The ANOVA table reports each \(SS\), its \(df\), then \(MS\) and \(F\); permutation testing changes only the p-value column.
Total variability \(SS_T\) is partitioned into sums of squares for model terms and the residual (error) sum of squares \(SS_E\).

Worked miniature example (table formatting)

Suppose a model has two terms (A and B). After computing \(SS\) via nested models and using permutation p-values, an ANOVA table could be presented as:

Source \(df\) \(SS\) \(MS\) \(F\) Permutation p
A 2 120.0 \(120.0/2=60.0\) \(60.0/12.5=4.8\) 0.031
B 1 18.0 \(18.0/1=18.0\) \(18.0/12.5=1.44\) 0.228
Residuals 24 300.0 \(300.0/24=12.5\)
Total 27 438.0

Practical checklist for “make lmperm output into anova table”

  1. List model terms in the desired testing scheme (sequential Type I or partial via reduced vs full).
  2. For each term \(j\), compute \(SS_j\) from nested-model \(SSE\) differences and compute \(df_j\).
  3. Set \(SS_E=SSE_{\text{full}}\) and \(df_E=n-p\); compute \(MS_E\).
  4. Compute \(MS_j\) and \(F_j\) using \(F_j=MS_j/MS_E\).
  5. Fill the p-value column using permutation p-values for each \(F_j\).
Vote on the accepted answer
Upvotes: 0 Downvotes: 0 Score: 0
Community answers No approved answers yet

No approved community answers are published yet. You can submit one below.

Submit your answer Moderated before publishing

Plain text only. Your name is required. Links, HTML, and scripts are blocked.

Fresh

Most recent questions

109 questions · Sorted by newest first

Showing 1–10 of 109
per page
  1. Mar 5, 2026 Published
    Formula of the Variance (Population and Sample)
    Statistics Numerical Descriptive Measures Measures of Dispersion for Ungrouped Data
  2. Mar 5, 2026 Published
    Mean Median Mode Calculator (Formulas, Interpretation, and Example)
    Statistics Numerical Descriptive Measures Measures of Central Tendency for Ungrouped Data
  3. Mar 4, 2026 Published
    How to Calculate Standard Deviation in Excel (STDEV.S vs STDEV.P)
    Statistics Numerical Descriptive Measures Measures of Dispersion for Ungrouped Data
  4. Mar 4, 2026 Published
    Suppose T and Z Are Random Variables: How T Relates to Z in the t Distribution
    Statistics Estimation of the Mean and Proportion Estimation of a Population Mean σ Not Known the T Distribution
  5. Mar 4, 2026 Published
    What Does R Squared Mean in Statistics (Coefficient of Determination)
    Statistics Simple Linear Regression Coefficient of Determination
  6. Mar 3, 2026 Published
    Box and Plot Graph (Box Plot) Explained
    Statistics Numerical Descriptive Measures Box and Whisker Plot
  7. Mar 3, 2026 Published
    How to Calculate a Z Score
    Statistics Continuous Random Variables and the Normal Distribution Standardizing a Normal Distribution
  8. Mar 3, 2026 Published
    How to Calculate Relative Frequency
    Statistics Organizing and Graphing Data Organizing and Graphing Quantitative Data
  9. Mar 3, 2026 Published
    Is zero an even number?
    Statistics Numerical Descriptive Measures Measures of Central Tendency for Ungrouped Data
  10. Mar 3, 2026 Published
    Monty Hall Paradox (Conditional Probability Explained)
    Statistics Probability Marginal and Conditional Probabilities
Showing 1–10 of 109
Open the calculator for this topic