# t.diff: The differences of P-values in t test assuming equal or... In MSG: Data and Functions for the Book Modern Statistical Graphics

## Description

Given that the variances of two groups are unequal, we compute the difference of P-values assuming equal or unequal variances respectively by simulation.

## Format

A data frame with 1000 rows and 99 columns.

## Details

See the Examples section for the generation of this data.

By simulation.

## References

Welch B (1947). “The generalization of Student's problem when several different population variances are involved.” Biometrika, 34(1/2), 28–35.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21``` ```data(t.diff) boxplot(t.diff, axes = FALSE, xlab = expression(n)) axis(1) axis(2) box() ## reproducing the data if (interactive()) { set.seed(123) t.diff = NULL for (n1 in 2:100) { t.diff = rbind(t.diff, replicate(1000, { x1 = rnorm(n1, mean = 0, sd = runif(1, 0.5, 1)) x2 = rnorm(30, mean = 1, sd = runif(1, 2, 5)) t.test(x1, x2, var.equal = TRUE)\$p.value - t.test(x1, x2, var.equal = FALSE)\$p.value })) } t.diff = as.data.frame(t(t.diff)) colnames(t.diff) = 2:100 } ```

MSG documentation built on May 2, 2019, 3:25 a.m.