generate_report_cchebyshev: Generate a Microsoft Word document about the Chebyshev...

View source: R/cmahalanobis.R

generate_report_cchebyshevR Documentation

Generate a Microsoft Word document about the Chebyshev distances matrix or matrices (two or more) and the p-values matrix or matrices (two or more).

Description

This function takes a dataframe, a factor or factors (two or more) and returns a Microsoft Word document about the Chebyshev distances matrix or matrices (two or more) and the p-values matrix or matrices (two or more).

Usage

generate_report_cchebyshev(
  dataset,
  formula,
  pvalue.method = "permutation",
  seed = NULL,
  min_group_size = 3,
  num_replicas = 1000,
  automatic_encoding = TRUE,
  na_removal = TRUE,
  grouping_stat = "mean"
)

Arguments

dataset

A dataframe.

formula

A variable or variables (two or more) with factors which you want to calculate the Chebyshev distances matrix or matrices (two or more) and the p_values matrix or matrices (two or more).

pvalue.method

A p_value method used to calculate the matrix or matrices (two or more), the default value is "permutation". Another method is "bootstrap".

seed

Optionally, set a seed for "bootstrap" and "permutation".

min_group_size

Minimum group size to maintain. The default value is 3, therefore groups, inside variables, with less than 3 observations will be discarded.

num_replicas

Number of permutations or bootstraps trials, the default value is 1000.

automatic_encoding

Logical, if TRUE, names inside factor variables will be transformed in numbers with ordinal order (1,2,....).

na_removal

Logical, if TRUE, missing value removal on rows is performed.

grouping_stat

When a factor variable is specified, calculate the specified grouping statistic for each factor. Available methods are: mean (arithmetic mean), median and SDS (standard deviations).

Value

A Microsoft Word document about the Chebyshev distances matrix or matrices (two or more) and the p_values matrix or matrices (two or more).

Note

About pvalues, this function leverages on an early stopping procedure in which the resulting matrix is printed also if the specified number of replicas is not reached; if every 500 replicas the maximum difference between each p_value does not exceed 0.0001, the function will print the entire matrix, else it continues.

Examples


generate_report_cchebyshev(CO2, ~Plant + Type,
   pvalue.method = "permutation",
   seed = 122,
   num_replicas = 10,
   grouping_stat = 'median', 
   automatic_encoding = TRUE)

generate_report_cchebyshev(airquality, ~Ozone,
   pvalue.method = 'bootstrap',
   na_removal = TRUE, num_replicas = 10)


cmahalanobis documentation built on Aug. 31, 2026, 5:07 p.m.