Description Usage Arguments Value Examples
View source: R/mantel_comparison_to_base.R
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 to a base case – (usually the no-preprocessing specification).
| 1 2 3 4 5 6 7 8 | mantel_comparison_to_base(
  distance_matrices,
  names = NULL,
  permutations = 1000,
  base_dfm_index = 128,
  text_size = 1,
  return_values = FALSE
)
 | 
| distance_matrices | A list of document distance matrices from th3 '$distance_matrices' field of the output from the 'scaling_comparison()' function. | 
| names | Optional argument giving names for each preprocessing step. | 
| permutations | The number of permutations to be used in each Mantel test. Defaults to 1000. | 
| base_dfm_index | Which dfm should be used as a base case for comparing r statistics with bootstrapped confidence intervals. | 
| text_size | The 'cex' for the x-labels, defaults to 1. | 
| return_values | Logical indicating whether test statistics and confidence bounds should be returned as a data.frame or not. Defaults to FALSE. | 
A data.frame with mantel statistics and 95 percent confidence intervals comparing all other preprocessing choices to base case, and/or a plot of confidence intervals.
| 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 comparison to base and plot
mantel_comparison_to_base(scaling_results$distance_matrices,
                          names = 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.