# compareProportion: Compare proportions between 2 groups In ProjectMOSAIC/mosaic: Project MOSAIC Statistics and Mathematics Teaching Utilities

## Description

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

## Usage

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

## Arguments

 `formula` a formula `data` a data frame in which `x` is evaluated if `x` is a formula. `...` other arguments

## Value

the difference in proportions between the second and first group

## Note

This function is now defunct. Use `diffprop()` instead.

## Examples

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

ProjectMOSAIC/mosaic documentation built on Aug. 19, 2018, 9:14 a.m.