Description Usage Arguments Details Value Author(s) References Examples

Hotelling's T2 test for one and two samples.

1 | ```
hotelling.test(matrix1, matrix2 = NULL)
``` |

`matrix1` |
A numeric matrix or dataframe in which each row represents an observation of a multivariate random variable, and each column represents a dimension of that variable. |

`matrix2` |
An optional second numeric matrix or dataframe of the same column rank as 'matrix1'. |

If a single matrix is provided, this function tests the alternative hypothesis that all column means are not equal to zero. If a second matrix is provided, the alternative hypothesis to be tested is that the group means are not all equal. The statistic is tested using an F-distribution which assumes that the matrices represent (roughly) multivariate normal variables.

This function is only designed for multivariate tests of location. If a univariate test is desired, please use a t-test.

An object of class 'Hotelling.test', a list containing the elements:

`f.value` |
The value of the test statistic. |

`df1` |
The numerator degrees of freedom for the F statistic. |

`df2` |
The denominator degrees of freedom for the F statistic |

`p.value` |
The p-value for the test. |

`samples` |
The number of independent samples involved in the test. |

Santiago Barreda <sbarreda@ucdavis.edu>

Hotelling, H. (1931). The generalization of Student's ratio. Annals of Mathematical Statistics 2 (3): 360-378.

http://en.wikipedia.org/wiki/Hotelling's_T-squared_distribution

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ```
## load Peterson & Barney data
data (pb52)
## separate the Peterson & Barney vowels by speaker
## gender and age (child vs. adult)
men = pb52[pb52$sex == 'm' & pb52$type == 'm',]
women = pb52[pb52$sex == 'f' & pb52$type == 'w',]
boys = pb52[pb52$sex == 'm' & pb52$type == 'c',]
girls = pb52[pb52$sex == 'f' & pb52$type == 'c',]
## fit 4 separate models which predict F1 frequency
## on the basis of vowel category.
men = rcr (f1 ~ vowel, men$speaker, men)
women = rcr (f1 ~ vowel, women$speaker, women)
boys = rcr (f1 ~ vowel, boys$speaker, boys)
girls = rcr (f1 ~ vowel, girls$speaker, girls)
## A Hotelling T2 test indicates that there are
## significant differences in F1 frequency
## based on vowel category between males and females
hotelling.test (men$coefficients, women$coefficients)
## but no significant differences based on the same
## criteria between boys and girls.
hotelling.test (boys$coefficients, girls$coefficients)
``` |

```
[1] "21.6551279985494 10 50"
Hotelling's Two-Sample T2-test
Alternative hypothesis: Group means are not all equal.
f = 21.65513 , df1 = 10 , df2 = 50 , p.value = 7.327472e-15
[1] "2.76324878982235 10 4"
Hotelling's Two-Sample T2-test
Alternative hypothesis: Group means are not all equal.
f = 2.763249 , df1 = 10 , df2 = 4 , p.value = 0.1697232
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.