crosstabs.20x {s20x}R Documentation

Crosstabulation of two variables

Description

Produces a 2-way table of counts and the corresponding chi-square test of independence or homogeneity.

Usage

crosstabs.20x(~ fac1 + fac2) 

Arguments

formula a symbolic description of the model to be fit: ~ fac1 + fac2; where fac1 and fac2 are vectors to be crosstabulated and treated internally as factors.

Value

An invisible list containing the following components:

row.props a matrix of row proportions, i.e. cell counts divided by row marginals.
col.props a matrix of column proportions, i.e. cell counts divided by column marginals.
Totals a matrix containing the cell counts and the marginal totals.

Examples

##body image data: 
data(bodim)
attach(bodim)
crosstabs.20x(~ ethnicity + married)
detach(bodim)

[Package s20x version 2.0.1 Index]