multinom.test | R Documentation |
Peforms a two-sample test for two multinomial vectors testing H_0: the underlying multinomial probability vectors are the same vs. H_1: they are different.
multinom.test(x, y = NULL)
x, y |
Integer vectors (or matrices/dataframes containing multiple
integer vector observations as rows). |
The statistic
and its associated p-value
.
If x
and y
are either matrices or dataframes, a
statistic
and p-value
will be returned for each row.
Amanda Plunkett & Junyong Park (2018) Two-Sample Test for Sparse High Dimensional Multinomial Distributions, TEST, https://doi.org/10.1007/s11749-018-0600-8
#Generate two vectors from the same distribution: data <- genMultinomialData(sample_size=1) #Perform test (the following three calls of multinom.test are equivalent): multinom.test(x=data[[1]], y=data[[2]]) multinom.test(data) data |> multinom.test() #Generate 1000 vectors from each of two different distributions: data <- genMultinomialData(null_hyp=FALSE,sample_size=1000) #Perform test (compare the ith row of x to the ith row of y for all rows): result <- multinom.test(x=data[[1]],y=data[[2]]) #Return power of test at the alpha=0.05 level: alpha <- 0.05 mean(result$pvalue<alpha)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.