Learn R Programming

flipr (version 0.2.1)

test-statistic: Test Statistics for the Two-Sample Problem

Description

This function implements the original Hotelling's $T^2$ statistic which is defined for multivariate data when the number $n$ of observations is greater than the number $p$ of variables.

Usage

stat_hotelling(data, indices, ...)

stat_t(data, indices, ...)

stat_f(data, indices, ...)

stat_mean(data, indices, ...)

Arguments

data

A list of the n1 + n2 concatenated observations with the original n1 observations from the first sample on top and the original n2 observations from the second sample below.

indices

An integer vector giving the indices in data that are considered to belong to the first sample.

...

Extra parameters (might be useful for other user-supplied stat_*() functions). Not used here.

Value

A real scalar giving the value of Hotelling's $T^2$ statistic.

Examples

Run this code
# NOT RUN {
n <- 10L
mx <- 0
sigma <- 1

# Two different models for the two populations
x <- rnorm(n = n, mean = mx, sd = sigma)
x <- as.list(x)
delta <- 10
my <- mx + delta
y <- rnorm(n = n, mean = my, sd = sigma)
y <- as.list(y)
stat_hotelling(c(x, y), 1:n)
stat_t(c(x, y), 1:n)
stat_mean(c(x, y), 1:n)
# }

Run the code above in your browser using DataLab