Description Usage Arguments Value Examples
Calculates Mantel test statistics for differences between distance matrices for a list of distance matrices (one per preprocessing method) supplied by the 'scaling_comparison()' function.
1 | mantel_comparison(distance_matrices, labels = NULL, permutations = 1000)
|
distance_matrices |
A list of document distance matrices generated by the 'scaling_comparison()' and returned in the '$distance_matrices' field. |
labels |
Optional argument giving names for each preprocessing step. This is generated by the 'factorial_preprocessing()' function and returned in the '$labels' field. |
permutations |
The number of permutations to be used in each Mantel test. Defaults to 1000. |
A result list object where the first entry is a matrix summarizing mantel test statistics. The second object in the list is a matrix of the values described above. The third object is a list of all raw mantel results.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ## Not run:
# load the package
library(preText)
# load in the data
data("UK_Manifestos")
# preprocess data
preprocessed_documents <- factorial_preprocessing(
UK_Manifestos,
use_ngrams = TRUE,
infrequent_term_threshold = 0.02,
verbose = TRUE)
# scale documents
scaling_results <- scaling_comparison(preprocessed_documents$dfm_list,
dimensions = 2,
distance_method = "cosine",
verbose = TRUE)
# run mantel tests
mantel_results <- mantel_comparison(scaling_results$distance_matrices,
labels = preprocessed_documents$labels,
permutations = 1000)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.