| Title: | PERMANOVA using the F2 Statistic |
|---|---|
| Description: | Implements the F2 statistic of Anderson et al. (2017) <doi:10.1111/anzs.12176> for permutational multivariate analysis of variance (PERMANOVA) on dissimilarity matrices. The F2 statistic uses group-specific dispersion estimates, so group centroids can be compared when dispersions differ and group sizes are unequal. P-values are obtained by permutation, bootstrap, or bias-adjusted bootstrap. The formula interface follows 'adonis2()' in the 'vegan' package. |
| Authors: | Lakviru Perera [aut, cre, cph] (ORCID: <https://orcid.org/0009-0003-7717-3532>), Mark Greenwood [aut] (ORCID: <https://orcid.org/0000-0001-6933-1201>) |
| Maintainer: | Lakviru Perera <[email protected]> |
| License: | GPL-2 |
| Version: | 0.1.1 |
| Built: | 2026-11-05 12:47:31 UTC |
| Source: | https://github.com/lakviruperera/f2adonis2 |
Analysis of variance using distance matrices for partitioning variation among sources. Unlike standard PERMANOVA, this function uses the F2 statistic (Anderson 2017) which accounts for heterogeneous dispersions (Behrens-Fisher problem).
F2_adonis2( formula, data, permutations = 999, method = "euclidean", sqrt.dist = FALSE, add = FALSE, by = NULL, parallel = getOption("mc.cores"), na.action = na.fail, strata = NULL, bootstrap = FALSE, bias.adjust = FALSE, plot.dist = TRUE, ... )F2_adonis2( formula, data, permutations = 999, method = "euclidean", sqrt.dist = FALSE, add = FALSE, by = NULL, parallel = getOption("mc.cores"), na.action = na.fail, strata = NULL, bootstrap = FALSE, bias.adjust = FALSE, plot.dist = TRUE, ... )
formula |
Model formula. The LHS must be a community data matrix or a dissimilarity matrix. The RHS must define a single factor predictor. |
data |
A data frame containing the independent variables. |
permutations |
Number of permutations for the test, or a permutation matrix. |
method |
Pairwise distance method used in |
sqrt.dist |
Logical; take square root of dissimilarities to "euclidify" them. |
add |
Add a constant to dissimilarities to avoid negative eigenvalues. Options are "lingoes" or "cailliez". |
by |
Validation restricted to |
parallel |
Number of parallel processes to use. |
na.action |
Handling of missing values on the RHS. |
strata |
Groups within which to constrain permutations. |
bootstrap |
Logical; perform separate-sample residual bootstrapping in dissimilarity space (Anderson 2017). |
bias.adjust |
Logical; apply empirical bias correction to bootstrap variances. |
plot.dist |
Logical; if TRUE (default), plot the permutation distribution of the F2 statistic. |
... |
Other arguments passed to |
F2_adonis2 implements the multivariate F2 statistic and the
matrix-based bootstrap procedure derived in Anderson et al. (2017).
An object of classes F2_adonis2, anova.cca,
anova and data.frame: an ANOVA-style table with rows
Model, Residual and Total, and columns Df,
SumOfSqs, F2 and Pr(>F2). If bootstrap = TRUE,
the column Pr(>F2.boot) is added, and if bias.adjust = TRUE,
Pr(>F2.ba) as well. The permutation values of the F2 statistic are
stored in the attribute F.perm.
Lakviru Perera (based on logic by Marti J. Anderson)
Anderson, M. J., Walsh, D. C., Clarke, K. R., Gorley, R. N., & Guerra-Castro, E. (2017). Some solutions to the multivariate Behrens–Fisher problem for dissimilarity-based analyses. Australian & New Zealand Journal of Statistics.
# Load internal package data objects data("pkd_metadata", package = "F2Adonis2") data("pkd_metabolites", package = "F2Adonis2") # Set up a data frame for the group factor pkd_meta <- data.frame(Group = factor(pkd_metadata$Group)) # Example using 99 permutations fit <- F2_adonis2( formula = as.matrix(pkd_metabolites) ~ Group, data = pkd_meta, method = "euclidean", permutations = 99, plot.dist = FALSE ) print(fit)# Load internal package data objects data("pkd_metadata", package = "F2Adonis2") data("pkd_metabolites", package = "F2Adonis2") # Set up a data frame for the group factor pkd_meta <- data.frame(Group = factor(pkd_metadata$Group)) # Example using 99 permutations fit <- F2_adonis2( formula = as.matrix(pkd_metabolites) ~ Group, data = pkd_meta, method = "euclidean", permutations = 99, plot.dist = FALSE ) print(fit)
Metadata containing geographical location assignments for the 101 sampled sites in the Norway benthic community dataset.
norway_metadatanorway_metadata
A data frame with 101 rows and 1 column:
A grouping factor with 5 levels indicating the specific geographical region.
Ellingsen, K.E. and Gray, J.S. (2002), Journal of Animal Ecology, 71(3), 373-389, doi:10.1046/j.1365-2656.2002.00606.x. Data as provided with Anderson et al. (2017), doi:10.1111/anzs.12176 (Data S1).
A presence-absence matrix for 809 marine macrofauna species across 101 sites, utilized as a baseline biological validation dataset.
norway_panorway_pa
A matrix with 101 rows (sites) and 809 columns (species).
Ellingsen, K.E. and Gray, J.S. (2002), Journal of Animal Ecology, 71(3), 373-389, doi:10.1046/j.1365-2656.2002.00606.x. Data as provided with Anderson et al. (2017), doi:10.1111/anzs.12176 (Data S1).
An auto-scaled, log-transformed intensity matrix of urinary profiles (metabolites) from early-stage Polycystic Kidney Disease patients and healthy controls.
pkd_metabolitespkd_metabolites
A matrix with 95 rows (samples) and 1554 columns (metabolites).
Derived from the urinary metabolomics cohort in Houske et al. (2023), American Journal of Physiology-Renal Physiology, 324(6), F590-F602, doi:10.1152/ajprenal.00301.2022.
A dataset containing group categories for the Polycystic Kidney Disease (PKD) cohort, used to demonstrate multivariate testing under biological heterogeneity.
pkd_metadatapkd_metadata
A data frame with 95 rows (samples) and 1 column:
A factor indicating disease classification status (Ctrl vs PKD).
Derived from the urinary metabolomics cohort in Houske et al. (2023), American Journal of Physiology-Renal Physiology, 324(6), F590-F602, doi:10.1152/ajprenal.00301.2022.