calcStats: calculate preliminary statistical significance analysis

View source: R/np_utility.R

calcStatsR Documentation

calculate preliminary statistical significance analysis

Description

calcStats takes a numeric vector and a factor and runs a preliminary statistical analysis. Output is printed to the screen and the p-value is returned as a character string.

Usage

calcStats(
  x,
  by,
  type = c("Wilcox", "Tukey", "T.Test", "ANOVA"),
  verbose = FALSE
)

Arguments

x

numeric; numeric vector of data points to analyze.

by

factor; factor describing the groups within x to test.

type

character; determines which statistical test should be used. Accepted values are 'wilcox', 't.test', 'ttest', 'anova' and 'tukey'. Values not matching a valid input will produce a warning.

verbose

logical; will print statistical output to the screen if set TRUE. Calculations returned by the function either way.

Details

This is designed to be used in conjunction with data visualization plots to help with data exploration and should not be used for a robust statistical analysis. Normal distribution, variance and other data characteristics are not evaluated and there is no guarantee that the underling test assumptions are met. For two level factors wilcox.test or t.test is recommended. If the factor has more than two levels then pairwise.wilcox.test and pairwise.t.test are automatically selected. In this case anova and the optional follow-up TukeyHSD can also be used. All output it printed to the console and for the two level tests and anova the p-value is returned as a text string.

Value

A three element list with the test type, test result object and the p-value as a text string (if available).

See Also

wilcox.test, pairwise.wilcox.test, t.test, pairwise.t.test, anova, TukeyHSD

Examples

data(iris)
#calcStats is not exported but you can invoke it using the calcType options:
test<-niceBox(iris$Sepal.Length, by=iris$Species, calcType="anova", showCalc=TRUE)
test$stats


ZachHunter/NicePlots.R documentation built on Sept. 23, 2023, 4:04 a.m.