Learn R Programming

smsets (version 2.0.0)

Hotelling.mat: Hotelling's \(T^2\) test with extra information

Description

An R function which implements Hotelling's \(T^2\) test assuming equal covariance matrices, with extra information.

Usage

Hotelling.mat(x, group, level1)

Value

Returns an object of class "Hotelling.mat", a list containing the following components:

nameA character string describing the function.T2.listA list containing two data frames with the mean vector for the two samples, two covariance matrices, one matrix per sample, the pooled covariance matrix, the inverse of the pooled covariance matrix, the Hotelling's \(T^2\) statistic, the \(F\)-statistic, the degrees of freedom for the \(F\)-statistic and the P-value.
groupa character string specifying the name of the two-level factor defining groups.levels.group
a vector of length two, showing the two levels in factor group.data.namea character string giving the name of the data.

Arguments

x

a data frame with one two-level factor and p response variables.

group

two-level factor defining groups. It must be one of the columns in x.

level1

a character string identifying Sample 1. The string must be one of the factor levels in group.

Author

Jorge Navarro Alberto, ganava4@gmail.com

Details

This function is a simplified version of the function hotelling.test implemented in the Hotelling package for the comparison of mean values of two multivariate samples, under the assumption that covariance matrices are equal. The summary methods in Hotelling.mat gives more detailed information of the calculations behind the \(T^2\) test.

References

Manly, B.F.J., Navarro Alberto, J.A. and Gerow, K. (2024) Multivariate Statistical Methods. A Primer. 5th Edn. Chapman and Hall/CRC.

Examples

Run this code
data(sparrows)
results.T2 <- Hotelling.mat(sparrows, group = Survivorship, level1 = "S")
# Brief output
results.T2

Run the code above in your browser using DataLab