mantel_comparison_to_base: Ensemble Mantel Tests

Description Usage Arguments Value Examples

Description

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).

Usage

1
2
3
mantel_comparison_to_base(distance_matrices, names = NULL,
  permutations = 1000, base_dfm_index = 128, text_size = 1,
  return_values = FALSE)

Arguments

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.

Value

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.

Examples

 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)

preText documentation built on May 1, 2019, 8:27 p.m.