Title: | Tests for the Equality of Coefficients of Variation from Multiple Groups |
---|---|
Description: | Contains functions for testing for significant differences between multiple coefficients of variation. Includes Feltz and Miller's (1996) <DOI:10.1002/(SICI)1097-0258(19960330)15:6%3C647::AID-SIM184%3E3.0.CO;2-P> asymptotic test and Krishnamoorthy and Lee's (2014) <DOI:10.1007/s00180-013-0445-2> modified signed-likelihood ratio test. See the vignette for more, including full details of citations. |
Authors: | Ben Marwick [aut, cre], Kalimuthu Krishnamoorthy [aut] |
Maintainer: | Ben Marwick <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.0 |
Built: | 2024-11-10 05:15:19 UTC |
Source: | https://github.com/benmarwick/cvequality |
Test for k samples (k sample populations with unequal sized) from Feltz CJ, Miller GE (1996) An asymptotic test for the equality of coefficients of variation from k population. Stat Med 15:647–658
asymptotic_test(x, y, seed)
asymptotic_test(x, y, seed)
x |
a numeric vector containing individual measurement values |
y |
a vector of any type containing a grouping variable |
seed |
optional, an integer that is the starting point used in the generation of a sequence of random numbers. Include a seed if you want reproducible output. |
a list with the test statistic and p-value
y <- unlist(lapply(letters[1:5], function(i) rep(i, 20))) x <- rnorm(100) asymptotic_test(x, y)
y <- unlist(lapply(letters[1:5], function(i) rep(i, 20))) x <- rnorm(100) asymptotic_test(x, y)
Test for k samples (k sample populations with unequal sized) from Feltz CJ, Miller GE (1996) An asymptotic test for the equality of coefficients of variation from k population. Stat Med 15:647–658
asymptotic_test2(k, n, s, x, seed)
asymptotic_test2(k, n, s, x, seed)
k |
a numeric vector the number of groups |
n |
a numeric vector the numer of measurements in each group |
s |
a numeric vector the standard deviation of each group |
x |
a numeric vector the mean of each group |
seed |
optional, an integer that is the starting point used in the generation of a sequence of random numbers. Include a seed if you want reproducible output. |
a list with the test statistic and p-value
# Summary stats from Feltz and Miller 1996 miller <- data.frame(test = c('ELISA', 'WEHI', '`Viral inhibition`'), Mean = c(6.8, 8.5, 6.0), CV = c(0.090, 0.462, 0.340), N = c(5, 5, 5)) # compute SD from mean and cv miller$SD <- with(miller, CV * Mean) asymptotic_test2(k = nrow(miller), n = miller$N, s = miller$SD, x = miller$Mean)
# Summary stats from Feltz and Miller 1996 miller <- data.frame(test = c('ELISA', 'WEHI', '`Viral inhibition`'), Mean = c(6.8, 8.5, 6.0), CV = c(0.090, 0.462, 0.340), N = c(5, 5, 5)) # compute SD from mean and cv miller$SD <- with(miller, CV * Mean) asymptotic_test2(k = nrow(miller), n = miller$N, s = miller$SD, x = miller$Mean)
LRT_STAT, required by mlrt_test
LRT_STAT(n, x, s, seed)
LRT_STAT(n, x, s, seed)
n |
... as above |
x |
... |
s |
... |
seed |
optional, an integer that is the starting point used in the generation of a sequence of random numbers. Include a seed if you want reproducible output. |
xx
Modified signed-likelihood ratio test (SLRT) for equality of CVs, using measurement data
mslr_test(nr = 1000, x, y, seed)
mslr_test(nr = 1000, x, y, seed)
nr |
numeric vector length one, number of simulation runs, default is 1e3 |
x |
a numeric vector containing individual measurement values |
y |
a vector of any type containing a grouping variable |
seed |
optional, an integer that is the starting point used in the generation of a sequence of random numbers. Include a seed if you want reproducible output. |
a list with the test statistic and p-value
http://link.springer.com/article/10.1007/s00180-013-0445-2 Krishnamoorthy, K. & Lee, M. Comput Stat (2014) 29: 215. doi:10.1007/s00180-013-0445-2
x <- rnorm(100) y <- unlist(lapply(letters[1:5], function(i) rep(i, 20))) mslr_test(nr = 1e3, x, y)
x <- rnorm(100) y <- unlist(lapply(letters[1:5], function(i) rep(i, 20))) mslr_test(nr = 1e3, x, y)
# Modified signed-likelihood ratio test (SLRT) for equality of CVs, using summary statistics when raw measurement data are not available.
mslr_test2(nr, n, x, s, seed)
mslr_test2(nr, n, x, s, seed)
nr |
numeric vector lenght one, number of simulation runs |
n |
a numeric vector, the number of observations in each group |
x |
a numeric vector, the mean of each group |
s |
a numeric vector, the standard deviation of each group |
seed |
optional, an integer that is the starting point used in the generation of a sequence of random numbers. Include a seed if you want reproducible output. |
a list with the test statistic and p-value
http://link.springer.com/article/10.1007/s00180-013-0445-2
# Summary stats from Feltz and Miller 1996 miller <- data.frame(test = c('ELISA', 'WEHI', '`Viral inhibition`'), Mean = c(6.8, 8.5, 6.0), CV = c(0.090, 0.462, 0.340), N = c(5, 5, 5)) # compute SD from mean and cv miller$SD <- with(miller, CV * Mean) mslr_test2(nr = 1e3, n = miller$N, s = miller$SD, x = miller$Mean)
# Summary stats from Feltz and Miller 1996 miller <- data.frame(test = c('ELISA', 'WEHI', '`Viral inhibition`'), Mean = c(6.8, 8.5, 6.0), CV = c(0.090, 0.462, 0.340), N = c(5, 5, 5)) # compute SD from mean and cv miller$SD <- with(miller, CV * Mean) mslr_test2(nr = 1e3, n = miller$N, s = miller$SD, x = miller$Mean)