contingency.tables: Contingency Tables

Description Usage Arguments Value See Also Examples

Description

Creates a contingency.tables object

Usage

1
contingency.tables(row.vars, col.vars, stratum.var, data=NULL, missing.include=FALSE )

Arguments

row.vars

A variable or data frame evaluated in data

col.vars

A variable or data frame evaluated in data

stratum.var

A variable evaluated in data

data

A data.frame

missing.include

A logical indicating whether a missing category should be included in the table

Value

A list with class "contingency.tables." Each element of the list is a single contingency table of class "contin.table" corresponding to each combination of elements of row.vars and col.vars stratified by stratum.var

See Also

extract.counts

Examples

1
2
3
4
5
6
7
8
temp.data<-data.frame(a=rnorm(100)>0,b=rnorm(100)>0,gender=rep(c("male","female"),50))
#a vs. b stratified by gender
tab<-contingency.tables(a,b,gender,data=temp.data)
tab

##add in chi-squared tests
tab<-add.chi.squared(tab)
tab

Example output

Loading required package: ggplot2
Loading required package: JGR
Loading required package: rJava
Loading required package: JavaGD

Please type JGR() to launch console. Platform specific launchers (.exe and .app) can also be obtained at http://www.rforge.net/JGR/files/.


Loading required package: car
Loading required package: carData
Loading required package: MASS
Registered S3 methods overwritten by 'lme4':
  method                          from
  cooks.distance.influence.merMod car 
  influence.merMod                car 
  dfbeta.influence.merMod         car 
  dfbetas.influence.merMod        car 


Note Non-JGR console detected:
	Deducer is best used from within JGR (http://jgr.markushelbig.org/).
	To Bring up GUI dialogs, type deducer().

================================================================================

               ==================================================               
                      ========== Table: a by b ==========                      

                       | -- Stratum = female --
                       | b 
                     a |    FALSE  |     TRUE  | Row Total | 
-----------------------|-----------|-----------|-----------|
       FALSE  Count    |       11  |       15  |       26  | 
              Row %    |   42.308% |   57.692% |   52.000% | 
              Column % |   55.000% |   50.000% |           | 
              Total %  |   22.000% |   30.000% |           | 
-----------------------|-----------|-----------|-----------|
        TRUE  Count    |        9  |       15  |       24  | 
              Row %    |   37.500% |   62.500% |   48.000% | 
              Column % |   45.000% |   50.000% |           | 
              Total %  |   18.000% |   30.000% |           | 
-----------------------|-----------|-----------|-----------|
          Column Total |       20  |       30  |       50  | 
              Column % |   40.000% |   60.000% |           | 

                       | -- Stratum = male --
                       | b 
                     a |    FALSE  |     TRUE  | Row Total | 
-----------------------|-----------|-----------|-----------|
       FALSE  Count    |       11  |       12  |       23  | 
              Row %    |   47.826% |   52.174% |   46.000% | 
              Column % |   39.286% |   54.545% |           | 
              Total %  |   22.000% |   24.000% |           | 
-----------------------|-----------|-----------|-----------|
        TRUE  Count    |       17  |       10  |       27  | 
              Row %    |   62.963% |   37.037% |   54.000% | 
              Column % |   60.714% |   45.455% |           | 
              Total %  |   34.000% |   20.000% |           | 
-----------------------|-----------|-----------|-----------|
          Column Total |       28  |       22  |       50  | 
              Column % |   56.000% |   44.000% |           | 


================================================================================
================================================================================

               ==================================================               
                      ========== Table: a by b ==========                      

                       | -- Stratum = female --
                       | b 
                     a |    FALSE  |     TRUE  | Row Total | 
-----------------------|-----------|-----------|-----------|
       FALSE  Count    |       11  |       15  |       26  | 
              Row %    |   42.308% |   57.692% |   52.000% | 
              Column % |   55.000% |   50.000% |           | 
              Total %  |   22.000% |   30.000% |           | 
-----------------------|-----------|-----------|-----------|
        TRUE  Count    |        9  |       15  |       24  | 
              Row %    |   37.500% |   62.500% |   48.000% | 
              Column % |   45.000% |   50.000% |           | 
              Total %  |   18.000% |   30.000% |           | 
-----------------------|-----------|-----------|-----------|
          Column Total |       20  |       30  |       50  | 
              Column % |   40.000% |   60.000% |           | 

                       | -- Stratum = male --
                       | b 
                     a |    FALSE  |     TRUE  | Row Total | 
-----------------------|-----------|-----------|-----------|
       FALSE  Count    |       11  |       12  |       23  | 
              Row %    |   47.826% |   52.174% |   46.000% | 
              Column % |   39.286% |   54.545% |           | 
              Total %  |   22.000% |   24.000% |           | 
-----------------------|-----------|-----------|-----------|
        TRUE  Count    |       17  |       10  |       27  | 
              Row %    |   62.963% |   37.037% |   54.000% | 
              Column % |   60.714% |   45.455% |           | 
              Total %  |   34.000% |   20.000% |           | 
-----------------------|-----------|-----------|-----------|
          Column Total |       28  |       22  |       50  | 
              Column % |   56.000% |   44.000% |           | 



                                Large Sample           
                           Test Statistic    DF p-value
Stratum = female    Chi Squared 0.12         1  0.729  
  Stratum = male    Chi Squared 1.155        1  0.283  





================================================================================

Deducer documentation built on May 2, 2019, 8:35 a.m.