A function to facilitate 2 group permutation tests for a categorical outcome variable

1 | ```
compareProportion(formula, data = NULL, ...)
``` |

`formula` |
a formula |

`data` |
a data frame in which |

`...` |
other arguments |

the difference in proportions between the second and first group

This funciton has been deprecated. Use `diffprop`

instead.

1 2 3 4 5 6 7 8 9 10 | ```
if (require(mosaicData)) {
data(HELPrct)
# calculate the observed difference
mean(homeless=="housed" ~ sex, data=HELPrct)
obs <- diffprop(homeless=="housed" ~ sex, data=HELPrct); obs
# calculate the permutation distribution
nulldist <- do(100) * diffprop(homeless=="housed" ~ shuffle(sex), data=HELPrct)
histogram(~ diffprop, groups=(diffprop>= obs), nulldist,
xlab="difference in proportions")
}
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.