groupcompare | R Documentation |
Performs a variety of statistical tests and generates plots to compare two groups.
groupcompare (ds, paired=FALSE, cl=0.95, alternative="two.sided",
qtest=TRUE, q=seq(0.1, 0.9, by=0.1), qt=7, lognorm=TRUE,
R=3000, plots=TRUE, out=FALSE, verbose=TRUE)
ds |
A data frame in long format, where the first column represents the observations and the second column the group names or labels. |
paired |
A logical flag indicating whether the group data is paired (i.e., related). Set to TRUE for paired groups. |
cl |
Confidence level for the interval. The default is 0.95. The significance level (Alpha, Type I error) equals 1-cl. |
alternative |
Type of alternative hypothesis: $ |
qtest |
Logical; if $ |
q |
A vector of quantile probabilities specifying the quantiles to be compared. The default is $ |
qt |
An integer between 0 and 9 specifying the quantile calculation method. The default is 7. |
lognorm |
Logical; if $ |
R |
An integer indicating the number of permutations or bootstrap samples. The default is 3000. |
plots |
Logical; if $ |
out |
Logical; if $ |
verbose |
Logical; if $ |
This function calculates descriptive statistics and performs a t-test or Wilcoxon test on two groups of data, depending on the variance homogeneity test and normality test. It also generates various plots, including density plots, ECDF plots, boxplots, violin plots, QQ plots, symmetry plots, and empirical shift plots, to visualize the data.
A list that contains the results of the statistical tests and the bivariate plots, if plots
is TRUE
.
descriptives |
A data frame containing summary statistics, such as mean, standard deviation, and sample size, for each group. |
quantiles |
A data frame with calculated quantile values for specified probabilities for each group. |
test |
The outcome of the appropriate statistical test (e.g., t-test or Wilcoxon test), including test statistic and p-value. |
quantest |
A data frame containing quantile comparison results if |
inference |
A string summarizing the conclusion of the statistical test performed, indicating whether the null hypothesis was rejected or not. |
Zeynel Cebeci, A. Firat Ozdemir, Engin Yildiztepe
bootstrap
, permtest
, bivarplot
# Test with default values
df <- data.frame(grp1 = rnorm(50), grp2 = rnorm(50))
df <- wide2long(df)
result <- groupcompare(df)
print(result)
# Test with daily weight gain of two quail breeds
data(quail)
result <- groupcompare(quail, alternative="two.sided", cl=0.95,
R=200, plots=TRUE, out=FALSE, verbose=TRUE)
print(result)
# Test with milk trace mineral data
filepath <- system.file("extdata", "milkcomp.csv", package = "groupcompare")
milktrace <- read.table(filepath, header=TRUE, sep=",")
head(milktrace)
milkzinc <- as.data.frame(cbind(milktrace$Zn, milktrace$grp))
colnames(milkzinc) <- c("zn","grp")
head(milkzinc)
tail(milkzinc)
result <- groupcompare(milkzinc, cl=0.99, alternative="greater",
R=200, plots=TRUE, out=FALSE, verbose=TRUE)
print(result)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.