Robust Hotelling T2 test
Performs one and two sample Hotelling T2 tests as well as robust one-sample Hotelling T2 test
T2.test(x, ...) ## Default S3 method: T2.test(x, y = NULL, mu = 0, conf.level = 0.95, method=c("c", "mcd"), ...) ## S3 method for class 'formula' T2.test(formula, data, subset, na.action, ...)
x |
a (non-empty) numeric data frame or matrix. |
y |
an optional (non-empty) numeric data frame or matrix. |
mu |
an optional (non-empty) numeric vector of data values (or a single number which will be repeated p times) indicating the true value of the mean (or difference in means if you are performing a two sample test). |
conf.level |
confidence level of the interval |
method |
the method to be used - 'c' for sample mean and covariance matrix and 'mcd' for minimum covariance determinant estimator. A two-sample MCD based T2-test is not yet implemented. |
formula |
a formula of the form |
data |
an optional matrix or data frame (or similar: see
|
subset |
an optional vector specifying a subset of observations to be used (currently not used) |
na.action |
a function which indicates what should happen when
the data contain |
... |
further arguments to be passed to or from methods. |
The formula interface is only applicable for the two-sample tests.
A list with class "htest"
containing the following components:
statistic |
the value of the T2-statistic. |
parameter |
the degrees of freedom for the T2-statistic. |
p.value |
the p-value for the test. |
conf.int |
a confidence interval for the mean vector appropriate to the specified alternative hypothesis. |
estimate |
the estimated mean vector or vectors depending on whether it was a one-sample test or a two-sample test. |
null.value |
the specified hypothesized value of the mean or mean difference depending on whether it was a one-sample test or a two-sample test. |
alternative |
a character string describing the alternative hypothesis. |
method |
a character string indicating what type of T2-test was performed. |
data.name |
a character string giving the name(s) of the data. |
Valentin Todorov valentin.todorov@chello.at
Willems G., Pison G., Rousseeuw P. and Van Aelst S. (2002), A robust hotelling test, Metrika, 55, 125–138.
## One-sample classical test data(delivery) delivery.x <- delivery[,1:2] T2.test(delivery.x) ## One-sample robust test data(delivery) delivery.x <- delivery[,1:2] T2.test(delivery.x, method="mcd") ## Two-sample classical test data(hemophilia) grp <-as.factor(hemophilia[,3]) x <- hemophilia[which(grp==levels(grp)[1]),1:2] y <- hemophilia[which(grp==levels(grp)[2]),1:2] T2.test(x,y) ## or using the formula interface T2.test(as.matrix(hemophilia[,-3])~hemophilia[,3]) ## Not run: ## Two-sample robust test T2.test(x,y, method="mcd") ## error - not yet implemented ## End(Not run)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.