multkw.perm: Extended Multivariate Kruskal-Wallis test with missing data

View source: R/multkw_perm.R

multkw.permR Documentation

Extended Multivariate Kruskal-Wallis test with missing data

Description

This function computes an "extended" multivariate Kruskal-Wallis test for n numeric variables (which can contain NA's) relative to one factorial variable (that subsets the dataset in groups)

Usage

multkw.perm(nmc, group, y, r, weight, print = TRUE)

Arguments

nmc

Number of Monte-Carlo permutations to do.

group

The factorial variable that subsets the dataset in groups. Can be a character vector, a factorial vector or an integer/numeric vector.

y

The dataset of n numeric(or integer) variables.

r

Optional. The missing data pattern to be applied. If dataset has NA and if the missing data pattern is the distribution of the NA's in the dataset, r is optional and is automatically computed.

weight

Optional. The weighting scheme to be used to compute the final value of the test statistic. As test statistics are calculated for each pattern of missingness, there are as statistics as patterns. The final test statistic can thus be the arithmetic mean of each statistic (weight="equal") or the ponderated mean of each statistic relative to the proportion of each missing pattern (weight="prop").

print

Whether the test should be printed (TRUE, the default) or not (e.g., to be stored in an object)

Details

"Likelihood-based" and "permutation-based" multivariate Kruskal-Wallis tests are computed: in large samples, the distribution of the test statistic approximates that of the khi?, but in smaller samples, a more accurate p-value is obtained by computing an "empirical" distribution of the test statistic by doing a Monte-Carlo sampling with permutations. Firstly, the "multivariate Kruskal-Wallis test with missing data" is computed and are the first half of the outputs; they are the "likelihood-based" test results (see documentation of multkw.m for more details). Thus, a Monte-Carlo sampling with permutations (by randomly assigning individuals to groups) is computed, and the second half of the outputs are the proportions of results that exceeds the previously observed results (with the likelihood-based test).

Value

Returns a list of results of the various multivariate Kruskal-Wallis tests that have been computed. The results are the test statistics (W2), the degrees of freedom (df) and the p-value of the test statistic. These three results are given for (1) a "classical" multivariate Kruskal-Wallis test, i.e. on data without missing values; each test statistic is thus followed by a .c for "complete" and (2) a global multivariate Kruskal-Wallis test that takes into account missing values (see details); each test statistic is thus followed by a .m for "missing".

Author(s)

Fanyin He (most of the statistical function)

Jacob Maugoust (packaging)

References

\insertRef

He.etal.2017ULT

See Also

See chapter 2.2.2 and 4.2 of the PhD manuscript of Fanyin He and 'Methodology' of \insertCiteHe.etal.2017;textualULT for more details.

Examples

data(airquality)
datamkw<-airquality[,1:4]
multkw(y=datamkw,airquality$Month)
multkw.m(y=datamkw,airquality$Month)
multkw.perm(y=datamkw,airquality$Month,nmc=100)
multkw.perm(y=datamkw,airquality$Month,nmc=10000)


jacobmaugoust/ULT documentation built on May 16, 2023, 1:29 p.m.