multkw.m | R Documentation |
This function computes a multivariate Kruskal-Wallis test for n numeric variables (which can contain NA's) relative to one factorial variable (that subsets the dataset in groups)
multkw.m(group, y, r, weight, print = TRUE)
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 |
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 ( |
print |
Whether the test should be printed ( |
A "likelihood-based" multivariate Kruskal-Wallis test is computed ; in large samples, the test statistic is approximately khi² distributed. A first "classic" multivariate Kruskal-Wallis test is computed on "complete" data (i.e. removing the rows with at least one missing value). A second test is computed and include missing values: the test is computed for each "missing pattern" (i.e. missing pattern 1 = no missing data ; missing pattern 2 = missing data only in the first variable, etc) and a general test statistic is thus obtained from the "partial" test statistics. See also option "weight". Finally, outputs allow to compare results with complete data only and with missing data. As the test statistic is approximately khi² distributed (in large samples), p-values are based on khi² distributions. Degrees of freedom ar not the same for the "complete" data test and for the "missing" data test, see the See Also section.
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".
Fanyin He (most of the statistical function)
Jacob Maugoust (packaging)
He.etal.2017ULT
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.
data(airquality)
datamkw<-airquality[,1:4]
multkw(y=datamkw,airquality$Month)
multkw.m(y=datamkw,airquality$Month)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.