meanTest.two {MNormTest} | R Documentation |
Two Mean Vectors Hypothesis Testing
Description
Test whether the mean vectors of two multivariate normal populations are equal when the covariance matrices are equal or unequal. The null hypothesis is that "H0: mu1 = mu2".
Usage
meanTest.two(
data1,
data2,
alpha = 0.05,
equal = TRUE,
method = c("None", "Coupled", "Transformed"),
verbose = TRUE
)
Arguments
data1 |
A matrix or data frame of group 1. |
data2 |
A matrix or data frame of group 2. |
alpha |
The significance level. Default is 0.05. |
equal |
A boolean value. Default is TRUE. If TRUE, the covariance matrix is equal. If FALSE, the covariance matrix is not equal. |
method |
A string value. Default is "None". When equal is FALSE, you must choose a method in "Coupled" or "Transformed". Choose "Coupled" when the sample size of two groups is equal. Choose "Transformed" when the sample size of two groups is not equal. |
verbose |
A boolean value. Default is TRUE. If TRUE, the null hypothesis will be displayed. If FALSE, the test will be carried out silently. |
Value
An object of class "testResult", which is a list with the following elements: Return when the param equal is TRUE.
Conclusion |
The conclusion of the test. |
Stat |
A data frame containing the statistics, p value and critical value. |
SampMean1 |
The sample mean of group 1. |
SampMean2 |
The sample mean of group 2. |
SampA1 |
The sample deviation of group 1. |
SampA2 |
The sample deviation of group 2. |
MixSampA |
The mixed sample deviation. |
Df |
The degree of freedom. |
Return when the param equal is FALSE and method is "Coupled".
Conclusion |
The conclusion of the test. |
Stat |
A data frame containing the statistics, p value and critical value. |
SampMeanC |
The sample mean of coupled data. |
SampAC |
The sample deviation of coupled data. |
Df |
The degree of freedom. |
dataC |
The coupled data. |
Return when the param equal is FALSE and method is "Transformed".
Conclusion |
The conclusion of the test. |
Stat |
A data frame containing the statistics, p value and critical value. |
SampMeanT |
The sample mean of transformed data. |
SampAT |
The sample deviation of transformed data. |
Df |
The degree of freedom. |
dataT |
The transformed data. Return when the param equal is FALSE and method is "Transformed". |
Author(s)
Xifeng Zhang
References
Huixuan, Gao. Applied Multivariate Statistical Analysis. Peking University Press, 2005: pp.76-80.
Examples
data(iris)
X <- iris[1:50, 1:4]
Y <- iris[51:100, 1:4]
# carry out the test
test1 <- meanTest.two(X, Y)
test2 <- meanTest.two(X, Y, verbose = TRUE)
test3 <- meanTest.two(X, Y, equal = FALSE, method = "Coupled")
test4 <- meanTest.two(X, Y, equal = FALSE, method = "Transformed")
# get the elements
test1$Stat
test1$SampMean1
test3$SampMeanC
test4$dataT