Description Usage Arguments Details Examples

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

1 |

`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 |

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.

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")
``` |

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.