khi2: Khi2 test

View source: R/test.R

khi2R Documentation

Khi2 test

Description

This function computes the p-value of the khi2 goodness-of-fit test (only for univariate data).

Usage

khi2(data, proportion, mu, pi, nBoot = 1000)

Arguments

data

a matrix in which each row is a rank of size m.

proportion

a vector (which sums to 1) containing the K mixture proportion.

mu

a matrix of size K*m, where m is the size of a rank, containing the modal rankings of the model (position parameters).

pi

a vector of size K, where K is the number of clusters, containing the probabilities of a good paired comparison of the model (dispersion parameters).

nBoot

number of bootstrap iterations used to estimate the p-value.

Value

the p-value of the test.

Author(s)

Quentin Grimonprez

Examples

proportion <- c(0.4, 0.6)
pi <- c(0.8, 0.75)
mu <- matrix(c(1, 2, 3, 4, 4, 2, 1, 3), nrow = 2, byrow = TRUE)
# simulate a data set with declared parameters.
data <- rbind(
  simulISR(proportion[1] * 100, pi[1], mu[1, ]),
  simulISR(proportion[2] * 100, pi[2], mu[2, ])
)
pval <- khi2(data, proportion, mu, pi)


Rankcluster documentation built on Nov. 12, 2022, 9:05 a.m.