Learn R Programming

mosaic (version 0.3-13)

statTally: Tally test statistics

Description

Tally test statistics from data and from multiple draws from a simluated null distribution

Usage

statTally(sample, rdata, FUN, direction = NULL,
    stemplot = dim(rdata)[direction] < 201,
    q = c(0.5, 0.9, 0.95, 0.99), fun, ...)

Arguments

sample
sample data
rdata
a matrix of randomly generated data under null hypothesis.
FUN
a function that computes the test statistic from a data set.
direction
1 or 2 indicating whether samples in rdata are in rows (1) or columns (2).
stemplot
indicates whether a stem plot should be displayed
q
quantiles of sampling distribution to display
fun
same as FUN so you don't have to remember if it should be capitalized
...
additional arguments passed to xhistogram

Value

  • A lattice plot is returned invisibly but can be printed.

    As side effects, some information about the empirical sampling distribution and optionally a stem plot are printed to the screen.

Examples

Run this code
# is my spinner fair?
x <- c(10,18,9,15)   # counts in four cells
rdata <- rmultinom(1000, sum(x), prob=rep(.25,4))
print(statTally( x, rdata, fun=max ))  # unusual test statistic
print(statTally( x, rdata, fun=var ))  # equivalent to chi-squared test

Run the code above in your browser using DataLab