mChoice: Methods for Storing and Analyzing Multiple Choice Variables

Description Usage Arguments Value Author(s) See Also Examples

View source: R/mChoice.s

Description

mChoice is a function that is useful for grouping variables that represent individual choices on a multiple choice question. These choices are typically factor or character values but may be of any type. Levels of component factor variables need not be the same; all unique levels (or unique character values) are collected over all of the multiple variables. Then a new character vector is formed with integer choice numbers separated by semicolons. Optimally, a database system would have exported the semicolon-separated character strings with a levels attribute containing strings defining value labels corresponding to the integer choice numbers. mChoice is a function for creating a multiple-choice variable after the fact. mChoice variables are explicitly handed by the describe and summary.formula functions. NAs or blanks in input variables are ignored.

format.mChoice will convert the multiple choice representation to text form by substituting levels for integer codes. as.double.mChoice converts the mChoice object to a binary numeric matrix, one column per used level (or all levels of drop=FALSE. This is called by the user by invoking as.numeric. There is a print method and a summary method, and a print method for the summary.mChoice object. The summary method computes frequencies of all two-way choice combinations, the frequencies of the top 5 combinations, information about which other choices are present when each given choice is present, and the frequency distribution of the number of choices per observation. This summary output is used in the describe function.

in.mChoice creates a logical vector the same length as x whose elements are TRUE when the observation in x contains at least one of the codes or value labels in the second argument.

match.mChoice creats an integer vector of the indexes of all elements in table which contain any of the speicified levels

is.mChoice returns TRUE is the argument is a multiple choice variable.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
mChoice(..., label='',
        sort.levels=c('original','alphabetic'), 
        add.none=FALSE, drop=TRUE)

## S3 method for class 'mChoice'
format(x, minlength=NULL, sep=";", ...)

## S3 method for class 'mChoice'
as.double(x, drop=FALSE, ...)

## S3 method for class 'mChoice'
print(x, quote=FALSE, max.levels=NULL,
       width=getOption("width"), ...)

## S3 method for class 'mChoice'
as.character(x, ...)

## S3 method for class 'mChoice'
summary(object, ncombos=5, minlength=NULL, drop=TRUE, ...)

## S3 method for class 'summary.mChoice'
print(x, prlabel=TRUE, ...)

## S3 method for class 'mChoice'
x[..., drop=FALSE]

match.mChoice(x, table, nomatch=NA, incomparables=FALSE)

inmChoice(x, values)

is.mChoice(x)

## S3 method for class 'mChoice'
Summary(..., na.rm)

Arguments

na.rm

Logical: remove NA's from data

table

a vector (mChoice) of values to be matched against.

nomatch

value to return if a value for x does not exist in table.

incomparables

logical whether incomparable values should be compaired.

...

a series of vectors

label

a character string label attribute to attach to the matrix created by mChoice

sort.levels

set sort.levels="alphabetic" to sort the columns of the matrix created by mChoice alphabetically by category rather than by the original order of levels in component factor variables (if there were any input variables that were factors)

add.none

Set add.none to TRUE to make a new category 'none' if it doesn't already exist and if there is an observations with no choices selected.

drop

set drop=FALSE to keep unused factor levels as columns of the matrix produced by mChoice

x

an object of class "mchoice" such as that created by mChoice. For is.mChoice is any object.

object

an object of class "mchoice" such as that created by mChoice

ncombos

maximum number of combos.

width

With of a line of text to be formated

quote

quote the output

max.levels

max levels to be displayed

minlength

By default no abbreviation of levels is done in format and summary. Specify a positive integer to use abbreviation in those functions. See abbreviate.

sep

character to use to separate levels when formatting

prlabel

set to FALSE to keep print.summary.mChoice from printing the variable label and number of unique values

values

a scalar or vector. If values is integer, it is the choice codes, and if it is a character vector, it is assumed to be value labels.

Value

mChoice returns a character vector of class "mChoice" plus attributes "levels" and "label". summary.mChoice returns an object of class "summary.mChoice". inmChoice returns a logical vector. format.mChoice returns a character vector, and as.double.mChoice returns a binary numeric matrix.

Author(s)

Frank Harrell
Department of Biostatistics
Vanderbilt University
fh@fharrell.com

See Also

label, combplotp

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
options(digits=3)
set.seed(3)
n <- 20
sex <- factor(sample(c("m","f"), n, rep=TRUE))
age <- rnorm(n, 50, 5)
treatment <- factor(sample(c("Drug","Placebo"), n, rep=TRUE))


# Generate a 3-choice variable; each of 3 variables has 5 possible levels
symp <- c('Headache','Stomach Ache','Hangnail',
          'Muscle Ache','Depressed')
symptom1 <- sample(symp, n, TRUE)
symptom2 <- sample(symp, n, TRUE)
symptom3 <- sample(symp, n, TRUE)
cbind(symptom1, symptom2, symptom3)[1:5,]
Symptoms <- mChoice(symptom1, symptom2, symptom3, label='Primary Symptoms')
Symptoms
print(Symptoms, long=TRUE)
format(Symptoms[1:5])
inmChoice(Symptoms,'Headache')
levels(Symptoms)
inmChoice(Symptoms, 3)
inmChoice(Symptoms, c('Headache','Hangnail'))
# Note: In this example, some subjects have the same symptom checked
# multiple times; in practice these redundant selections would be NAs
# mChoice will ignore these redundant selections

meanage <- N <- numeric(5)
for(j in 1:5) {
 meanage[j] <- mean(age[inmChoice(Symptoms,j)])
 N[j] <- sum(inmChoice(Symptoms,j))
}
names(meanage) <- names(N) <- levels(Symptoms)
meanage
N

# Manually compute mean age for 2 symptoms
mean(age[symptom1=='Headache' | symptom2=='Headache' | symptom3=='Headache'])
mean(age[symptom1=='Hangnail' | symptom2=='Hangnail' | symptom3=='Hangnail'])

summary(Symptoms)

#Frequency table sex*treatment, sex*Symptoms
summary(sex ~ treatment + Symptoms, fun=table)
# Check:
ma <- inmChoice(Symptoms, 'Muscle Ache')
table(sex[ma])

# could also do:
# summary(sex ~ treatment + mChoice(symptom1,symptom2,symptom3), fun=table)

#Compute mean age, separately by 3 variables
summary(age ~ sex + treatment + Symptoms)


summary(age ~ sex + treatment + Symptoms, method="cross")

f <- summary(treatment ~ age + sex + Symptoms, method="reverse", test=TRUE)
f
# trio of numbers represent 25th, 50th, 75th percentile
print(f, long=TRUE)

Example output

Loading required package: lattice
Loading required package: survival
Loading required package: Formula
Loading required package: ggplot2

Attaching package: 'Hmisc'

The following objects are masked from 'package:base':

    format.pval, units

     symptom1       symptom2       symptom3     
[1,] "Muscle Ache"  "Muscle Ache"  "Muscle Ache"
[2,] "Muscle Ache"  "Muscle Ache"  "Depressed"  
[3,] "Stomach Ache" "Stomach Ache" "Depressed"  
[4,] "Headache"     "Muscle Ache"  "Headache"   
[5,] "Depressed"    "Muscle Ache"  "Muscle Ache"
 [1] Muscle Ache                       Muscle Ache;Depressed            
 [3] Stomach Ache;Depressed            Muscle Ache;Headache             
 [5] Muscle Ache;Depressed             Stomach Ache;Depressed;Hangnail  
 [7] Muscle Ache;Stomach Ache;Headache Hangnail                         
 [9] Muscle Ache;Headache;Depressed    Stomach Ache;Depressed           
[11] Stomach Ache;Headache             Stomach Ache;Headache;Hangnail   
[13] Stomach Ache;Headache;Hangnail    Stomach Ache;Headache;Depressed  
[15] Depressed                         Muscle Ache;Stomach Ache;Hangnail
[17] Stomach Ache;Headache;Depressed   Muscle Ache;Stomach Ache;Headache
[19] Stomach Ache;Headache;Hangnail    Muscle Ache;Hangnail             
attr(,"label")
[1] Primary Symptoms
Levels: Muscle Ache Stomach Ache Headache Depressed Hangnail
 [1] Muscle Ache                       Muscle Ache;Depressed            
 [3] Stomach Ache;Depressed            Muscle Ache;Headache             
 [5] Muscle Ache;Depressed             Stomach Ache;Depressed;Hangnail  
 [7] Muscle Ache;Stomach Ache;Headache Hangnail                         
 [9] Muscle Ache;Headache;Depressed    Stomach Ache;Depressed           
[11] Stomach Ache;Headache             Stomach Ache;Headache;Hangnail   
[13] Stomach Ache;Headache;Hangnail    Stomach Ache;Headache;Depressed  
[15] Depressed                         Muscle Ache;Stomach Ache;Hangnail
[17] Stomach Ache;Headache;Depressed   Muscle Ache;Stomach Ache;Headache
[19] Stomach Ache;Headache;Hangnail    Muscle Ache;Hangnail             
attr(,"label")
[1] Primary Symptoms
Levels: Muscle Ache Stomach Ache Headache Depressed Hangnail
[1] "Muscle Ache"            "Muscle Ache;Depressed"  "Stomach Ache;Depressed"
[4] "Muscle Ache;Headache"   "Muscle Ache;Depressed" 
 [1] FALSE FALSE FALSE  TRUE FALSE FALSE  TRUE FALSE  TRUE FALSE  TRUE  TRUE
[13]  TRUE  TRUE FALSE FALSE  TRUE  TRUE  TRUE FALSE
[1] "Muscle Ache"  "Stomach Ache" "Headache"     "Depressed"    "Hangnail"    
 [1] FALSE FALSE FALSE  TRUE FALSE FALSE  TRUE FALSE  TRUE FALSE  TRUE  TRUE
[13]  TRUE  TRUE FALSE FALSE  TRUE  TRUE  TRUE FALSE
 [1] FALSE FALSE FALSE  TRUE FALSE  TRUE  TRUE  TRUE  TRUE FALSE  TRUE  TRUE
[13]  TRUE  TRUE FALSE  TRUE  TRUE  TRUE  TRUE  TRUE
 Muscle Ache Stomach Ache     Headache    Depressed     Hangnail 
        48.9         48.4         49.6         49.1         47.1 
 Muscle Ache Stomach Ache     Headache    Depressed     Hangnail 
           9           12           10            9            7 
[1] 49.6
[1] 47.1
Primary Symptoms   14 unique combinations
Frequencies of Numbers of Choices Per Observation

nchoices
 1  2  3 
 3  7 10 

Pairwise Frequencies (Diagonal Contains Marginal Frequencies)
             Muscle Ache Stomach Ache Headache Depressed Hangnail
Muscle Ache   9           3            4        3         2      
Stomach Ache             12            8        5         5      
Headache                              10        3         3      
Depressed                                       9         1      
Hangnail                                                  7      

 Frequencies of Top 5 Combinations 

   Stomach Ache;Headache;Hangnail             Muscle Ache;Depressed 
                                3                                 2 
Muscle Ache;Stomach Ache;Headache            Stomach Ache;Depressed 
                                2                                 2 
  Stomach Ache;Headache;Depressed 
                                2 
sex     N= 20 

+---------+------------+--+--+-+
|         |            |N |f |m|
+---------+------------+--+--+-+
|treatment|Drug        | 7| 5|2|
|         |Placebo     |13| 8|5|
+---------+------------+--+--+-+
|Symptoms |Muscle Ache | 9| 5|4|
|         |Stomach Ache|12| 9|3|
|         |Headache    |10| 7|3|
|         |Depressed   | 9| 7|2|
|         |Hangnail    | 7| 5|2|
+---------+------------+--+--+-+
|Overall  |            |20|13|7|
+---------+------------+--+--+-+

f m 
5 4 
age     N= 20 

+---------+------------+--+----+
|         |            |N |age |
+---------+------------+--+----+
|sex      |f           |13|48.6|
|         |m           | 7|48.0|
+---------+------------+--+----+
|treatment|Drug        | 7|51.7|
|         |Placebo     |13|46.6|
+---------+------------+--+----+
|Symptoms |Muscle Ache | 9|48.9|
|         |Stomach Ache|12|48.4|
|         |Headache    |10|49.6|
|         |Depressed   | 9|49.1|
|         |Hangnail    | 7|47.1|
+---------+------------+--+----+
|Overall  |            |20|48.4|
+---------+------------+--+----+

 mean by sex, treatment, Symptoms 

    sex treatment                          Symptoms  N  age
1     f      Drug                         Depressed  0   NA
2     m      Drug                         Depressed  0   NA
3   ALL      Drug                         Depressed  0   NA
4     f   Placebo                         Depressed  1 47.6
5     m   Placebo                         Depressed  0   NA
6   ALL   Placebo                         Depressed  1 47.6
7     f       ALL                         Depressed  1 47.6
8     m       ALL                         Depressed  0   NA
9   ALL       ALL                         Depressed  1 47.6
10    f      Drug                          Hangnail  0   NA
11    m      Drug                          Hangnail  0   NA
12  ALL      Drug                          Hangnail  0   NA
13    f   Placebo                          Hangnail  0   NA
14    m   Placebo                          Hangnail  1 46.8
15  ALL   Placebo                          Hangnail  1 46.8
16    f       ALL                          Hangnail  0   NA
17    m       ALL                          Hangnail  1 46.8
18  ALL       ALL                          Hangnail  1 46.8
19    f      Drug                       Muscle Ache  0   NA
20    m      Drug                       Muscle Ache  0   NA
21  ALL      Drug                       Muscle Ache  0   NA
22    f   Placebo                       Muscle Ache  0   NA
23    m   Placebo                       Muscle Ache  1 46.3
24  ALL   Placebo                       Muscle Ache  1 46.3
25    f       ALL                       Muscle Ache  0   NA
26    m       ALL                       Muscle Ache  1 46.3
27  ALL       ALL                       Muscle Ache  1 46.3
28    f      Drug             Muscle Ache;Depressed  1 44.3
29    m      Drug             Muscle Ache;Depressed  0   NA
30  ALL      Drug             Muscle Ache;Depressed  1 44.3
31    f   Placebo             Muscle Ache;Depressed  1 50.8
32    m   Placebo             Muscle Ache;Depressed  0   NA
33  ALL   Placebo             Muscle Ache;Depressed  1 50.8
34    f       ALL             Muscle Ache;Depressed  2 47.6
35    m       ALL             Muscle Ache;Depressed  0   NA
36  ALL       ALL             Muscle Ache;Depressed  2 47.6
37    f      Drug              Muscle Ache;Hangnail  0   NA
38    m      Drug              Muscle Ache;Hangnail  0   NA
39  ALL      Drug              Muscle Ache;Hangnail  0   NA
40    f   Placebo              Muscle Ache;Hangnail  0   NA
41    m   Placebo              Muscle Ache;Hangnail  1 44.3
42  ALL   Placebo              Muscle Ache;Hangnail  1 44.3
43    f       ALL              Muscle Ache;Hangnail  0   NA
44    m       ALL              Muscle Ache;Hangnail  1 44.3
45  ALL       ALL              Muscle Ache;Hangnail  1 44.3
46    f      Drug              Muscle Ache;Headache  0   NA
47    m      Drug              Muscle Ache;Headache  1 51.3
48  ALL      Drug              Muscle Ache;Headache  1 51.3
49    f   Placebo              Muscle Ache;Headache  0   NA
50    m   Placebo              Muscle Ache;Headache  0   NA
51  ALL   Placebo              Muscle Ache;Headache  0   NA
52    f       ALL              Muscle Ache;Headache  0   NA
53    m       ALL              Muscle Ache;Headache  1 51.3
54  ALL       ALL              Muscle Ache;Headache  1 51.3
55    f      Drug    Muscle Ache;Headache;Depressed  1 56.1
56    m      Drug    Muscle Ache;Headache;Depressed  0   NA
57  ALL      Drug    Muscle Ache;Headache;Depressed  1 56.1
58    f   Placebo    Muscle Ache;Headache;Depressed  0   NA
59    m   Placebo    Muscle Ache;Headache;Depressed  0   NA
60  ALL   Placebo    Muscle Ache;Headache;Depressed  0   NA
61    f       ALL    Muscle Ache;Headache;Depressed  1 56.1
62    m       ALL    Muscle Ache;Headache;Depressed  0   NA
63  ALL       ALL    Muscle Ache;Headache;Depressed  1 56.1
64    f      Drug Muscle Ache;Stomach Ache;Hangnail  0   NA
65    m      Drug Muscle Ache;Stomach Ache;Hangnail  0   NA
66  ALL      Drug Muscle Ache;Stomach Ache;Hangnail  0   NA
67    f   Placebo Muscle Ache;Stomach Ache;Hangnail  1 46.3
68    m   Placebo Muscle Ache;Stomach Ache;Hangnail  0   NA
69  ALL   Placebo Muscle Ache;Stomach Ache;Hangnail  1 46.3
70    f       ALL Muscle Ache;Stomach Ache;Hangnail  1 46.3
71    m       ALL Muscle Ache;Stomach Ache;Hangnail  0   NA
72  ALL       ALL Muscle Ache;Stomach Ache;Hangnail  1 46.3
73    f      Drug Muscle Ache;Stomach Ache;Headache  1 55.1
74    m      Drug Muscle Ache;Stomach Ache;Headache  0   NA
75  ALL      Drug Muscle Ache;Stomach Ache;Headache  1 55.1
76    f   Placebo Muscle Ache;Stomach Ache;Headache  0   NA
77    m   Placebo Muscle Ache;Stomach Ache;Headache  1 45.2
78  ALL   Placebo Muscle Ache;Stomach Ache;Headache  1 45.2
79    f       ALL Muscle Ache;Stomach Ache;Headache  1 55.1
80    m       ALL Muscle Ache;Stomach Ache;Headache  1 45.2
81  ALL       ALL Muscle Ache;Stomach Ache;Headache  2 50.1
82    f      Drug            Stomach Ache;Depressed  1 51.0
83    m      Drug            Stomach Ache;Depressed  0   NA
84  ALL      Drug            Stomach Ache;Depressed  1 51.0
85    f   Placebo            Stomach Ache;Depressed  0   NA
86    m   Placebo            Stomach Ache;Depressed  1 46.4
87  ALL   Placebo            Stomach Ache;Depressed  1 46.4
88    f       ALL            Stomach Ache;Depressed  1 51.0
89    m       ALL            Stomach Ache;Depressed  1 46.4
90  ALL       ALL            Stomach Ache;Depressed  2 48.7
91    f      Drug   Stomach Ache;Depressed;Hangnail  1 48.5
92    m      Drug   Stomach Ache;Depressed;Hangnail  0   NA
93  ALL      Drug   Stomach Ache;Depressed;Hangnail  1 48.5
94    f   Placebo   Stomach Ache;Depressed;Hangnail  0   NA
95    m   Placebo   Stomach Ache;Depressed;Hangnail  0   NA
96  ALL   Placebo   Stomach Ache;Depressed;Hangnail  0   NA
97    f       ALL   Stomach Ache;Depressed;Hangnail  1 48.5
98    m       ALL   Stomach Ache;Depressed;Hangnail  0   NA
99  ALL       ALL   Stomach Ache;Depressed;Hangnail  1 48.5
100   f      Drug             Stomach Ache;Headache  0   NA
101   m      Drug             Stomach Ache;Headache  0   NA
102 ALL      Drug             Stomach Ache;Headache  0   NA
103   f   Placebo             Stomach Ache;Headache  1 47.1
104   m   Placebo             Stomach Ache;Headache  0   NA
105 ALL   Placebo             Stomach Ache;Headache  1 47.1
106   f       ALL             Stomach Ache;Headache  1 47.1
107   m       ALL             Stomach Ache;Headache  0   NA
108 ALL       ALL             Stomach Ache;Headache  1 47.1
109   f      Drug   Stomach Ache;Headache;Depressed  0   NA
110   m      Drug   Stomach Ache;Headache;Depressed  1 55.8
111 ALL      Drug   Stomach Ache;Headache;Depressed  1 55.8
112   f   Placebo   Stomach Ache;Headache;Depressed  1 41.7
113   m   Placebo   Stomach Ache;Headache;Depressed  0   NA
114 ALL   Placebo   Stomach Ache;Headache;Depressed  1 41.7
115   f       ALL   Stomach Ache;Headache;Depressed  1 41.7
116   m       ALL   Stomach Ache;Headache;Depressed  1 55.8
117 ALL       ALL   Stomach Ache;Headache;Depressed  2 48.7
118   f      Drug    Stomach Ache;Headache;Hangnail  0   NA
119   m      Drug    Stomach Ache;Headache;Hangnail  0   NA
120 ALL      Drug    Stomach Ache;Headache;Hangnail  0   NA
121   f   Placebo    Stomach Ache;Headache;Hangnail  3 48.0
122   m   Placebo    Stomach Ache;Headache;Hangnail  0   NA
123 ALL   Placebo    Stomach Ache;Headache;Hangnail  3 48.0
124   f       ALL    Stomach Ache;Headache;Hangnail  3 48.0
125   m       ALL    Stomach Ache;Headache;Hangnail  0   NA
126 ALL       ALL    Stomach Ache;Headache;Hangnail  3 48.0
127   f      Drug                               ALL  5 51.0
128   m      Drug                               ALL  2 53.5
129 ALL      Drug                               ALL  7 51.7
130   f   Placebo                               ALL  8 47.2
131   m   Placebo                               ALL  5 45.8
132 ALL   Placebo                               ALL 13 46.6
133   f       ALL                               ALL 13 48.6
134   m       ALL                               ALL  7 48.0
135 ALL       ALL                               ALL 20 48.4
Warning messages:
1: In chisq.test(tab, correct = FALSE) :
  Chi-squared approximation may be incorrect
2: In chisq.test(tab, correct = FALSE) :
  Chi-squared approximation may be incorrect
3: In chisq.test(tab, correct = FALSE) :
  Chi-squared approximation may be incorrect
4: In chisq.test(tab, correct = FALSE) :
  Chi-squared approximation may be incorrect
5: In chisq.test(tab, correct = FALSE) :
  Chi-squared approximation may be incorrect
6: In chisq.test(tab, correct = FALSE) :
  Chi-squared approximation may be incorrect


Descriptive Statistics by treatment

+------------------------------+----------------------+----------------------+------------------------------+
|                              |Drug                  |Placebo               |  Test                        |
|                              |(N=7)                 |(N=13)                |Statistic                     |
+------------------------------+----------------------+----------------------+------------------------------+
|age                           |        49.7/51.3/55.4|        45.3/46.4/47.6|   F=8.78 d.f.=1,18 P=0.008   |
+------------------------------+----------------------+----------------------+------------------------------+
|sex : m                       |           29%  (2)   |           38%  (5)   | Chi-square=0.2 d.f.=1 P=0.658|
+------------------------------+----------------------+----------------------+------------------------------+
|Primary Symptoms : Muscle Ache|           57%  (4)   |           38%  (5)   |Chi-square=0.64 d.f.=1 P=0.423|
+------------------------------+----------------------+----------------------+------------------------------+
|    Stomach Ache              |           57%  (4)   |           62%  (8)   |Chi-square=0.04 d.f.=1 P=0.848|
+------------------------------+----------------------+----------------------+------------------------------+
|    Headache                  |           57%  (4)   |           46%  (6)   |Chi-square=0.22 d.f.=1 P=0.639|
+------------------------------+----------------------+----------------------+------------------------------+
|    Depressed                 |           71%  (5)   |           31%  (4)   |Chi-square=3.04 d.f.=1 P=0.081|
+------------------------------+----------------------+----------------------+------------------------------+
|    Hangnail                  |           14%  (1)   |           46%  (6)   |Chi-square=2.03 d.f.=1 P=0.154|
+------------------------------+----------------------+----------------------+------------------------------+


Descriptive Statistics by treatment

+----------------+----------------------+----------------------+------------------------------+
|                |Drug                  |Placebo               |  Test                        |
|                |(N=7)                 |(N=13)                |Statistic                     |
+----------------+----------------------+----------------------+------------------------------+
|age             |        49.7/51.3/55.4|        45.3/46.4/47.6|   F=8.78 d.f.=1,18 P=0.008   |
+----------------+----------------------+----------------------+------------------------------+
|sex             |                      |                      | Chi-square=0.2 d.f.=1 P=0.658|
+----------------+----------------------+----------------------+------------------------------+
|    m           |           29%  (2)   |           38%  (5)   |                              |
+----------------+----------------------+----------------------+------------------------------+
|Primary Symptoms|                      |                      |                              |
+----------------+----------------------+----------------------+------------------------------+
|    Muscle Ache |           57%  (4)   |           38%  (5)   |Chi-square=0.64 d.f.=1 P=0.423|
+----------------+----------------------+----------------------+------------------------------+
|    Stomach Ache|           57%  (4)   |           62%  (8)   |Chi-square=0.04 d.f.=1 P=0.848|
+----------------+----------------------+----------------------+------------------------------+
|    Headache    |           57%  (4)   |           46%  (6)   |Chi-square=0.22 d.f.=1 P=0.639|
+----------------+----------------------+----------------------+------------------------------+
|    Depressed   |           71%  (5)   |           31%  (4)   |Chi-square=3.04 d.f.=1 P=0.081|
+----------------+----------------------+----------------------+------------------------------+
|    Hangnail    |           14%  (1)   |           46%  (6)   |Chi-square=2.03 d.f.=1 P=0.154|
+----------------+----------------------+----------------------+------------------------------+

Hmisc documentation built on Feb. 28, 2021, 9:05 a.m.