Description Usage Arguments Value Examples
Log-likelihood test for independence & goodness of fit. g.test() performs Williams' and Yates' correction; Monte Carlo simulation of p-values, via gtestsim.c. MC requires recompilation of R. Written by Peter Hurd (V3.3 Pete Hurd Sept 29 2001, phurd AT ualberta.ca). Yuliya Karpievitch added comments for ease of understanding and incorporated into MultiMat. G & q calculation from Sokal & Rohlf (1995) Biometry 3rd ed., TOI Yates correction taken from Mike Camanns 2x2 G-test function, GOF Yates correction as described in Zar (2000), more stuff taken from ctest's chisq.test().
1 |
x |
vector of boolean values corresponding to presence & absence eg: c(TRUE, TRUE, FALSE, FALSE) for present present absent absent values. Order of TRUE/FALSE does not matter, can be used interchangeably. Same length as parameter y |
y |
vector treatments (factor) corresponding to values in x, same length as x eg: as.factor(c('grp1;, 'grp1', 'grp2', 'grp2')) |
correct |
correction to apply, options: "yates", "williams", "none" default: "none" NOTE: in MultiMat we only tested & used correction = "none" |
p |
default: rep(1/length(x), length(x)), used in Yates correction NOTE: in MultiMat we only tested & used the default parameter value |
htest object the following variables
value of the G statistic produced by g test
degrees of freedom of the test
p-value
method used to produce statistic and p-value
data passed in to the function
matrix of observed counts
matrix of expected counts
1 2 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.