calcstatdif | R Documentation |
Calculates the differences in multiple statistics (mean, median, IQR, variance) for grouped data.
calcstatdif(x, indices, ...)
x |
A data frame or matrix containing the input data. The first column should be the variable of interest, and the second column should be the grouping variable. |
indices |
Optional; specific rows to be considered. If not provided, all rows are used. |
... |
Optional arguments; |
This function calculates the differences in multiple statistics (mean, median, interquartile range (IQR), and variance) for groups defined by the second column of the input data. The function is used in permutation test and bootstrapping as a statistical function.
A named numeric vector containing the differences in the specified statistics for each group. The names of the vector elements are "MEAN"
, "MED"
, "IQR"
, "VAR"
, "SKEW"
, and "KURT"
for mean, median, interquartile range, variance, skewness, and kurtosis, respectively.
Zeynel Cebeci, A. Firat Ozdemir, Engin Yildiztepe
calcquantdif
# Generate example data
set.seed(1199)
grp1 <- rnorm(20, 45, 5)
grp2 <- c(rnorm(10, 45, 10), rnorm(10, 52, 20))
df <- data.frame(cbind(grp1=grp1, grp2=grp2))
head(df)
bivarplot(df)
# Reshape the data into long format
df <- wide2long(df)
head(df)
# Differences between the basic stats
calcstatdif(df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.