| Title: | Automating Choosing Statistical Tests |
|---|---|
| Description: | Automatically selects and runs the most appropriate statistical test for your data, returning clear, easy-to-read results. Ideal for all experience levels. |
| Authors: | Wouter Zeevat [aut, cre] |
| Maintainer: | Wouter Zeevat <[email protected]> |
| License: | GPL-3 |
| Version: | 0.1.2 |
| Built: | 2026-06-08 08:44:19 UTC |
| Source: | https://github.com/wouterzeevat/automatedtests |
The AutomatedTest class represents a result of a statistical test. It contains attributes such as the p-value, degrees of freedom, and more.
new()
Initialize an instance of the AutomatedTest class
AutomatedTest$new(data, identifiers, compare_to = NULL, paired = FALSE)
dataA dataframe containing the data for the test.
identifiersA vector with the identifiers.
compare_toNumeric value to compare to for comparison in one-sample tests. Default is NULL.
pairedLogical; if TRUE, the test will be performed as paired if applicable. Default is FALSE.
get_data()
Get the data used in the test
AutomatedTest$get_data()
A dataframe with all features
is_paired()
Shows if the data is paired, if there are multiple rows with the same identifier, the data has more samples (TIDY DATA). Making the data paired.
AutomatedTest$is_paired()
Whether the data is paired (TRUE/FALSE).
get_identifiers()
A list of the identifiers used for the data
AutomatedTest$get_identifiers()
Returns the identifiers
get_compare_to()
Get the comparison value for one-sample tests
AutomatedTest$get_compare_to()
A numeric value for comparison
set_compare_co()
Updates the compare_to variable. Is public because the compare value can get changed depending on the type of test. This function is public because it needs to be able to be called by automatical_test()
AutomatedTest$set_compare_co(compare_to)
compare_toNumeric value to compare to.
Updated object with comparison value set.
get_datatypes()
Get the data types of the features in the object
AutomatedTest$get_datatypes()
A list of data types (e.g., Quantitative or Qualitative)
get_parametric_list()
Get the parametric test results of the features
AutomatedTest$get_parametric_list()
A list of parametric test results
is_parametric()
Check if the data meets parametric assumptions
AutomatedTest$is_parametric()
TRUE if parametric assumptions are met, otherwise FALSE
get_test()
Get the statistical test that was chosen
AutomatedTest$get_test()
The name of the statistical test
get_result()
Get the result of selected statistical test
AutomatedTest$get_result()
The result of the statistical test
get_strength()
Get the strength(s) of selected statistical test.
AutomatedTest$get_strength()
A named numeric value indicating the strength of the result. The type and meaning depend on the test used:
Effect size and direction of predictors in regression
Correlation strength and direction
Difference in group means
Test statistic measuring group difference or association
Ratio of variances across groups
Estimated success rate in the sample
No interpretable strength measure available
is_significant()
Whether the test results are significant or not.
AutomatedTest$is_significant()
TRUE / FALSE depending on the significance of the test.
print()
Print a summary of the test object
AutomatedTest$print()
clone()
The objects of this class are cloneable with this method.
AutomatedTest$clone(deep = FALSE)
deepWhether to make a deep clone.
Automatically choose the best fitting statistical test for your data, and returns an easily readable AutomatedTest object from either a data frame or individual vectors. This object contains the executed test together with all statistics and properties.
automatical_test(..., compare_to = NULL, identifiers = FALSE, paired = FALSE)automatical_test(..., compare_to = NULL, identifiers = FALSE, paired = FALSE)
... |
Either a single data frame or multiple equal-length vectors representing columns of data. |
compare_to |
A numeric value to compare against during a one-sample test.
If the data is categorical, the value will default to |
identifiers |
Logical; if TRUE, the first column/vector is treated as identifiers and excluded from testing. |
paired |
Logical; if TRUE, the test will be performed as paired if applicable, regardless of whether identifiers are provided. This applies to paired tests like McNemar's or the Cochran Q test. |
The automatical_test function automatically selects and runs the most fitting statistical test based on the data provided.
It can accept data as either a single data frame or multiple individual vectors, provided the vectors are of equal length.
If identifiers is set to TRUE, the first column will be treated as identifiers and excluded from the test, supporting TIDY data.
When a multiple group test is selected (i.e., more than two groups, columns, or variables are used), the first non-identifier column will be used as the grouping or target variable, meaning all other variables will be tested against it.
The paired parameter can be used to force paired testing for supported tests (such as McNemar's test or Cochran's Q),
even if identifiers are not explicitly included in the input.
If you want to override the defaults, you can change the compare_to value to specify one-sample tests.
Once the test has been executed, you can use the method $get_result() on the resulting object to get more detailed information about the test's execution, including a summary of the test used and all statistics.
Supported tests:
| ID | Test |
| 1 | One-proportion test |
| 2 | Chi-square goodness-of-fit test |
| 3 | One-sample Student's t-test |
| 4 | One-sample Wilcoxon test |
| 5 | Multiple linear regression |
| 6 | Binary logistic regression |
| 7 | Multinomial logistic regression |
| 8 | Pearson correlation |
| 9 | Spearman's rank correlation |
| 10 | Cochran's Q test |
| 11 | McNemar's test |
| 12 | Fisher's exact test |
| 13 | Chi-square test of independence |
| 14 | Student's t-test for independent samples |
| 15 | Welch's t-test for independent samples |
| 16 | Mann-Whitney U test |
| 17 | Student's t-test for paired samples |
| 18 | Wilcoxon signed-rank test |
| 19 | One-way ANOVA |
| 20 | Welch's ANOVA |
| 21 | Repeated measures ANOVA |
| 22 | Kruskal-Wallis test |
| 23 | Friedman test |
An object of class AutomatedTest.
The object contains the results of the statistical test performed on the data.
You can use the method $get_result() to obtain more detailed information about the execution of the test.
Wouter Zeevat
AutomatedTest for the class used by this function.
# Example 1: Using individual vectors test1 <- automatical_test(iris$Species, iris$Sepal.Length, identifiers = FALSE) # Example 2: Forcing a paired test before <- c(200, 220, 215, 205, 210) after <- c(202, 225, 220, 210, 215) paired_data <- data.frame(before, after) test2 <- automatical_test(before, after, paired = TRUE) # Retrieve more detailed information about the test # test1$get_result()# Example 1: Using individual vectors test1 <- automatical_test(iris$Species, iris$Sepal.Length, identifiers = FALSE) # Example 2: Forcing a paired test before <- c(200, 220, 215, 205, 210) after <- c(202, 225, 220, 210, 215) paired_data <- data.frame(before, after) test2 <- automatical_test(before, after, paired = TRUE) # Retrieve more detailed information about the test # test1$get_result()