g.test: G-test

Description Usage Arguments Details Examples

Description

Log-likelihood tests of independence & goodness of fit. The g.test function impliments Williams' and Yates' correction, and does Monte Carlo simulation of p-values, via gtestsim.c

Usage

1
g.test(x, y = NULL, correct="williams", p = rep(1/length(x), length(x)), simulate.p.value = FALSE, B = 2000)

Arguments

x

Vector of occurances for each category

y

Vector of occurances for each category

correct

How should the test statitics be corrected. Options= "none", "yates", "williams"

p

Vector of probabilities

simulate.p.value

Logical

B

Number of permutations to use. Default = 2000

Details

G & q calculation from Sokal & Rohlf (1995) Biometry 3rd ed.

TOI Yates' correction taken from Mike Camann's 2x2 G-test fn.

GOF Yates' correction as described in Zar (2000)

more stuff taken from ctest's chisq.test()

V3.3 Pete Hurd Sept 29 2001.

Examples

1
2
3
4
5
6
7
8
9
#Generate data
#Hat Island data
HI <- c(purple = 141, orange = 1)
#Strawberry Hill data
SH <- c(purple = 154, orange = 54)
(observed <- matrix(c(HI, SH), 2, dimnames = list(color = c("Purple", "Orange"), site = c("Hat Island", "Strawberry Hill"))))

#calcualte test statistic
g.test(observed, correct = "none")

mzinkgraf/BiometricsWWU documentation built on May 6, 2019, 9:09 a.m.