# G-test for binary variables

### Description

Performs a G-test for comparing response probabilities (i.e. when the response variable is a binary variable). The function is in fact a wrapper to the G-test for comparison of proportions on a contingency table. If the p-value of the test is significant, the function performs pairwise comparisons by using G-tests.

### Usage

1 |

### Arguments

`formula` |
a formula of the form |

`data` |
an optional data frame containing the variables in the formula |

`alpha` |
significance level to compute pairwise comparisons. |

`p.method` |
method for p-values correction. See help of |

### Details

If the response is a 0/1 variable, the probability of the '1' group is tested. In any other cases, the response is transformed into a factor and the probability of the second level is tested.

Since a G-test is an approximate test, an exact test is preferable when the number of individuals is small (200 is a reasonable minimum). See `fisher.bintest`

in that case.

### Value

`method.test` |
a character string giving the name of the global test computed. |

`data.name` |
a character string giving the name(s) of the data. |

`alternative` |
a character string describing the alternative hypothesis. |

`estimate` |
the estimated probabilities. |

`null.value` |
the value of the difference in probabilities under the null hypothesis, always 0. |

`statistic` |
test statistics. |

`parameter` |
test degrees of freedom. |

`p.value` |
p-value of the global test. |

`alpha` |
significance level. |

`p.adjust.method` |
method for p-values correction. |

`p.value.multcomp` |
data frame of pairwise comparisons result. |

`method.multcomp` |
a character string giving the name of the test computed for pairwise comparisons. |

### Author(s)

Maxime Herv<e9> <mx.herve@gmail.com>

### See Also

`chisq.bintest`

, `fisher.bintest`

### Examples

1 2 3 |