Type: Package
Title: Tests for the Equality of Coefficients of Variation from Multiple Groups
Version: 0.2.0
Maintainer: Ben Marwick <benmarwick@gmail.com>
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.
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
RoxygenNote: 6.1.1
Suggests: knitr, ggplot2, rmarkdown, testthat, dplyr, tidyr, ggbeeswarm, covr
VignetteBuilder: knitr
URL: https://github.com/benmarwick/cvequality
BugReports: https://github.com/benmarwick/cvequality/issues
Date: 2019-01-05
NeedsCompilation: no
Packaged: 2019-01-07 07:30:25 UTC; rstudio-user
Author: Ben Marwick [aut, cre], Kalimuthu Krishnamoorthy [aut]
Repository: CRAN
Date/Publication: 2019-01-07 15:10:02 UTC

LRT_STAT, required by mlrt_test

Description

LRT_STAT, required by mlrt_test

Usage

LRT_STAT(n, x, s, seed)

Arguments

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.

Value

xx


Asymptotic test for the equality of coefficients of variation from k populations, using measurement data

Description

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

Usage

asymptotic_test(x, y, seed)

Arguments

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.

Value

a list with the test statistic and p-value

Examples


 y <- unlist(lapply(letters[1:5], function(i) rep(i, 20)))
 x <- rnorm(100)

 asymptotic_test(x, y)


Asymptotic test for the equality of coefficients of variation from k populations, using summary statistics when raw measurement data are not available.

Description

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

Usage

asymptotic_test2(k, n, s, x, seed)

Arguments

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.

Value

a list with the test statistic and p-value

Examples


# 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)


Modified signed-likelihood ratio test (SLRT) for equality of CVs, using measurement data

Description

Modified signed-likelihood ratio test (SLRT) for equality of CVs, using measurement data

Usage

mslr_test(nr = 1000, x, y, seed)

Arguments

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.

Value

a list with the test statistic and p-value

References

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

Examples


 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.

Description

# Modified signed-likelihood ratio test (SLRT) for equality of CVs, using summary statistics when raw measurement data are not available.

Usage

mslr_test2(nr, n, x, s, seed)

Arguments

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.

Value

a list with the test statistic and p-value

References

http://link.springer.com/article/10.1007/s00180-013-0445-2

Examples


# 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)