- Home
- CRAN
**mosaic**: Project MOSAIC Statistics and Mathematics Teaching Utilities**compareProportion**: Compare proportions between 2 groups

# Compare proportions between 2 groups

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

`...` |
other arguments |

### Value

the difference in proportions between the second and first group

### Note

This funciton has been deprecated. 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")
}
``` |

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

- adapt_seq: Adaptively generate sequences in an interval
- aggregating: Aggregating functions
- aggregatingAux: Aggregate for mosaic
- aggregatingFunction1: 1-ary Aggregating functions
- aggregatingFunction1or2: 1- or 2-ary aggregating functions
- aggregatingFunction2: 2-ary aggregating functions
- ashplot: Average Shifted Histograms
- as-xtabs: Convert objects to xtabs format
- bargraph: Create bar graphs from raw data
- binom.test: Exact Tests for Proportions
- Broyden: Multi-Dimensional Root Finding
- Calculus: Derivative and Anti-derivative operators
- cdist: Central portion of a distribution
- chisq: Extract Chi-squared statistic
- CIAdata: Return a dataset based on the CIA World Factbook
- CIsim: Compute confidence intervals from (multiple) simulated data...
- clustering: mosaic tools for clustering
- coef: Extract coefficients from a function
- columns: return a vector of row or column indices
- compareMean: Compare means between 2 groups
- compareProportion: Compare proportions between 2 groups
- confint: Confidence interval methods for output of resampling
- cross: Factor cross products
- cull_for_do: Cull objects used with do()
- defunct-fetch: Defunct functions now in the fetch package
- deg2rad: Convert between degrees and radians
- deltaMethod: deltaMethod has moved to a separate package
- derivedVariable: Create new variables from logicals
- dfapply: apply-type function for data frames
- diffmean: Difference in means and proportions
- do: Do Things Repeatedly
- docFile: Return the path to a documentation file in a package
- dotPlot: Dotplots
- dpqrdist: Distribution wrapper
- ediff: Lagged Differences with equal length
- evalFormula: Evaluate a formula
- evalSubFormula: Evaluate a part of a formula
- expandFun: Expand the left-hand side of a formula
- factorize: Conditionally convert vectors to factors
- fav_stats: Some favorite statistical summaries
- findZeros: Find zeros of functions
- findZerosMult: Find the zeros of a function of two or more variables
- fitModel: Fit a nonlinear least squares model
- fitSpline: Fit splines to data
- formularise: Convert lazy objects into formulas
- fortify: Extract data from R objects
- freqpoly: Turn histograms into frequency polygons
- freqpolygon: Frequency Polygons
- FunctionsFromData: Create function from data
- geom_spline: Geoms and stats for spline smoother
- getVarFormula: Extract data from a data frame using a formula interface
- googleMap: Display a point on earth on a Google Map
- gwm: Groupwise models Construct a model based on groupwise means...
- inferArgs: Infer arguments
- inspect: Inspect objects
- integrateODE: Integrate ordinary differential equations
- interval: Extract summary statistics
- is.wholenumber: Check for whole number values
- joinFrames: Join data frames
- ladd: Add to Lattice Plots
- latlon2xyz: Convert back and forth between latitude/longitude and...
- linear.algebra: Functions for teaching linear algebra.
- logical2factor: Turn logicals into factors; leave other things alone
- logit: Logit and inverse logit functions
- MAD: All pairs mean and sum of absolute differences
- MAD_: All pairs mean and sum of absolute differences
- makeColorscheme: Create a color generating function from a vector of colors
- makeFun: Create a function from a formula
- makeMap: Make a map with 'ggplot2'
- mid: midpoints along a sequence
- mm: Construct a model based on groupwise means
- modelVars: extract predictor variables from a model
- mosaicformula: Convert formulas into standard shapes
- mosaic-internal: Check if formula
- mosaic.options: Setting options for mosaic package functions
- mosaic-package: mosaic: the Project MOSAIC package
- mplot: Generic plotting
- mPlotting: Interactive plotting
- MSPE: Mean Squared Prediction Error
- msummary: Modified summaries
- mUSMap: Make a US map with 'ggplot2'
- mWorldMap: Make a world map with 'ggplot2'
- named: List extraction
- nicenames: Nice names
- n_missing: counting missing elements
- ntiles: Create vector based on roughly equally sized groups
- numD: Numerical Derivatives
- oddsRatio: Odds Ratio and Relative Risk for 2 x 2 Contingency Tables
- panel.levelcontourplot: Lattice plot that draws a filled contour plot
- panel.lmbands: show confidence and preciction bands on plots
- panel.plotFun: Panel function for plotting functions
- panel.plotFun1: Panel function for plotting functions
- parseFormula: Parse formulas
- pdist: Illustrated probability calculations from distributions
- perctable: Cross tabulation displayed as percents or proportions
- plotCumfreq: Cumulative frequency plots
- plotDist: Plots of Discrete and Continuous Distributions
- plotFun: Plotting mathematical expressions
- plotModel: Plot a regression model
- plotPoints: Scatter plot of points
- pqrdata: The Data Distribution
- pqrdata2: The Data Distribution
- predict.groupwiseModel: Evaluate a groupwise model given new data
- project-methods: Projections
- prop: Compute proportions, percents, or counts for a single level
- prop.test: Exact and Approximate Tests for Proportions
- qdist: Illustrated quantile calculations from distributions
- rand: Random Regressors
- read.file: Read data files
- reexports: Objects exported from other packages
- relm: Resample a Linear Model
- repeater-class: Repeater objects
- resample: More Random Samples
- rescale: Rescale
- rflip: Tossing Coins
- rfun: Generate a natural-looking function
- rgeo: Sample longitude and latitude on a sphere
- rgeo-internals: rgeo internal functions
- rkintegrate: A simple Runge-Kutte integrator
- rspin: Simulate spinning a spinnner
- rsquared: Extract r-squared value
- r.squared: Extract r-squared value
- rstudio: Check whether RStudio is in use
- set.rseed: Set seed in parallel compatible way
- simplify: Takes a call and returns its polynomial coefficients
- sp2df: Transforms a shapefile into a dataframe
- standardName: Standardization of Geographic Names
- statTally: Tally test statistics
- surround: Format strings for pretty output
- swap: Swap values among columns of a data frame
- symbolicD: Symbolic Derivatives
- symbolicInt: Find the symbolic integral of a formula
- tally: Tabulate categorical data
- theme_map: ggplot2 theme for maps
- themes: Lattice Theme
- ttest: Student's t-Test
- TukeyHSD.lm: Additional interfaces to TukeyHSD
- update_ci: Update confidence interval
- value: Extract value from an object
- vector2df: Convert a vector to a data frame
- xchisq.test: Augmented Chi-squared test
- xhistogram: Augmented histograms
- xpnorm: Augmented versions of pnorm and qnorm
- xqqmath: Augmented version of 'qqmath'
- zscore: Compute z-scores