item.response.table: Create an Item Response Table or Data Frame

Description Usage Arguments Value See Also Examples

Description

The item.response.table function is used to summarize data arising from one, two, or three MRCVs. For the one and two MRCV cases, a cross-tabulation of the positive and negative responses for each (Wi, Yj) pair is presented as a table or data frame (where Wi = W for the one MRCV case). For the three MRCV case, a cross-tabulation of the positive and negative responses for each (Wi, Yj) pair is presented conditional on the response for each Zk.

Usage

1
item.response.table(data, I, J, K = NULL, create.dataframe = FALSE)

Arguments

data

A data frame containing the raw data where rows correspond to the individual item response vectors, and columns correspond to the items W1, ..., WI, Y1, ..., YJ, and Z1, ..., ZK (in this order).

I

The number of items corresponding to row variable W. I = 1 for the one MRCV case.

J

The number of items corresponding to column variable Y.

K

The number of items corresponding to strata variable Z.

create.dataframe

A logical value indicating whether the results should be presented as a data frame instead of a table.

Value

For create.dataframe = FALSE, item.response.table uses the tabular function (package tables) to produce tables of marginal counts.

For create.dataframe = TRUE, item.response.table returns the same information as above but presents it as a data frame. For the one MRCV case, the data frame contains rx2J rows and 4 columns generically named W, Y, yj, and count. For the two MRCV case, the data frame contains 2Ix2J rows and 5 columns named W, Y, wi, yj, and count. For the three MRCV case, the data frame contains 2Ix2Jx2K rows and 7 columns named W, Y, Z, wi, yj, zk, and count.

See Also

The marginal.table function for creating a marginal table that summarizes only the positive responses for each pair.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Create an item response table for 1 SRCV and 1 MRCV
farmer.irtable.one <- item.response.table(data = farmer1, I = 1, J = 5) 
farmer.irtable.one

# Create an item response data frame for 1 SRCV and 1 MRCV
farmer.irdataframe.one <- item.response.table(data = farmer1, I = 1, J = 5, 
    create.dataframe = TRUE) 
farmer.irdataframe.one

# Create an item response table for 2 MRCVs
farmer.irtable.two <- item.response.table(data = farmer2, I = 3, J = 4) 
farmer.irtable.two

# Create an item response table for 3 MRCVs
farmer.irtable.three <- item.response.table(data = farmer3, I = 3, J = 4, K = 5) 
farmer.irtable.three

Example output

                                          
   Y1      Y2      Y3      Y4      Y5     
   0  1    0  1    0  1    0  1    0  1   
 1 69 19   50 38   59 29   41 47   48 40  
 2 14  2   10  6    8  8    8  8   12  4  
 3 30  1   18 13   21 10   14 17   17 14  
 4 94 19   84 29   73 40   60 53   84 29  
 5 11  3   10  4    6  8    8  6    8  6  
   W  Y yj count
1  1 Y1  0    69
2  2 Y1  0    14
3  3 Y1  0    30
4  4 Y1  0    94
5  5 Y1  0    11
6  1 Y1  1    19
7  2 Y1  1     2
8  3 Y1  1     1
9  4 Y1  1    19
10 5 Y1  1     3
11 1 Y2  0    50
12 2 Y2  0    10
13 3 Y2  0    18
14 4 Y2  0    84
15 5 Y2  0    10
16 1 Y2  1    38
17 2 Y2  1     6
18 3 Y2  1    13
19 4 Y2  1    29
20 5 Y2  1     4
21 1 Y3  0    59
22 2 Y3  0     8
23 3 Y3  0    21
24 4 Y3  0    73
25 5 Y3  0     6
26 1 Y3  1    29
27 2 Y3  1     8
28 3 Y3  1    10
29 4 Y3  1    40
30 5 Y3  1     8
31 1 Y4  0    41
32 2 Y4  0     8
33 3 Y4  0    14
34 4 Y4  0    60
35 5 Y4  0     8
36 1 Y4  1    47
37 2 Y4  1     8
38 3 Y4  1    17
39 4 Y4  1    53
40 5 Y4  1     6
41 1 Y5  0    48
42 2 Y5  0    12
43 3 Y5  0    17
44 4 Y5  0    84
45 5 Y5  0     8
46 1 Y5  1    40
47 2 Y5  1     4
48 3 Y5  1    14
49 4 Y5  1    29
50 5 Y5  1     6
                                          
       y1       y2       y3       y4      
       0   1    0   1    0   1    0   1   
 w1 0  123 116  175 64   156 83   228 11  
    1   13  27   24 16    38  2    38  2  
 w2 0  128 121  181 68   165 84   237 12  
    1    8  22   18 12    29  1    29  1  
 w3 0  134 124  184 74   174 84   245 13  
    1    2  19   15  6    20  1    21  0  
$`z1 = 0`
                                          
       y1       y2       y3       y4      
       0   1    0   1    0   1    0   1   
 w1 0  115 88   152 51   126 77   193 10  
    1   11 21    20 12    30  2    30  2  
 w2 0  119 93   158 54   134 78   201 11  
    1    7 16    14  9    22  1    22  1  
 w3 0  125 95   161 59   142 78   208 12  
    1    1 14    11  4    14  1    15  0  

$`z1 = 1`
                                      
       y1      y2      y3      y4     
       0  1    0  1    0  1    0  1   
 w1 0  8  28   23 13   30 6    35 1   
    1  2   6    4  4    8 0     8 0   
 w2 0  9  28   23 14   31 6    36 1   
    1  1   6    4  3    7 0     7 0   
 w3 0  9  29   23 15   32 6    37 1   
    1  1   5    4  2    6 0     6 0   

$`z2 = 0`
                                         
       y1      y2       y3       y4      
       0  1    0   1    0   1    0   1   
 w1 0  93 72   126 39   104 61   157 8   
    1   7 17    16  8    23  1    23 1   
 w2 0  96 75   130 41   109 62   162 9   
    1   4 14    12  6    18  0    18 0   
 w3 0  99 76   131 44   113 62   166 9   
    1   1 13    11  3    14  0    14 0   

$`z2 = 1`
                                      
       y1      y2      y3      y4     
       0  1    0  1    0  1    0  1   
 w1 0  30 44   49 25   52 22   71 3   
    1   6 10    8  8   15  1   15 1   
 w2 0  32 46   51 27   56 22   75 3   
    1   4  8    6  6   11  1   11 1   
 w3 0  35 48   53 30   61 22   79 4   
    1   1  6    4  3    6  1    7 0   

$`z3 = 0`
                                         
       y1      y2       y3       y4      
       0  1    0   1    0   1    0   1   
 w1 0  82 74   121 35   101 55   149 7   
    1   9 19    17 11    28  0    26 2   
 w2 0  85 77   124 38   107 55   154 8   
    1   6 16    14  8    22  0    21 1   
 w3 0  90 80   127 43   115 55   161 9   
    1   1 13    11  3    14  0    14 0   

$`z3 = 1`
                                      
       y1      y2      y3      y4     
       0  1    0  1    0  1    0  1   
 w1 0  41 42   54 29   55 28   79 4   
    1   4  8    7  5   10  2   12 0   
 w2 0  43 44   57 30   58 29   83 4   
    1   2  6    4  4    7  1    8 0   
 w3 0  44 44   57 31   59 29   84 4   
    1   1  6    4  3    6  1    7 0   

$`z4 = 0`
                                        
       y1      y2       y3      y4      
       0  1    0   1    0  1    0   1   
 w1 0  61 63    95 29   89 35   118 6   
    1   7 17    16  8   23  1    23 1   
 w2 0  64 66    99 31   94 36   124 6   
    1   4 14    12  6   18  0    17 1   
 w3 0  67 68   101 34   99 36   128 7   
    1   1 12    10  3   13  0    13 0   

$`z4 = 1`
                                       
       y1      y2      y3      y4      
       0  1    0  1    0  1    0   1   
 w1 0  62 53   80 35   67 48   110 5   
    1   6 10    8  8   15  1    15 1   
 w2 0  64 55   82 37   71 48   113 6   
    1   4  8    6  6   11  1    12 0   
 w3 0  67 56   83 40   75 48   117 6   
    1   1  7    5  3    7  1     8 0   

$`z5 = 0`
                                         
       y1      y2       y3       y4      
       0  1    0   1    0   1    0   1   
 w1 0  76 81   123 34   107 50   148  9  
    1   8 21    20  9    28  1    27  2  
 w2 0  79 86   129 36   114 51   155 10  
    1   5 16    14  7    21  0    20  1  
 w3 0  83 87   130 40   119 51   159 11  
    1   1 15    13  3    16  0    16  0  

$`z5 = 1`
                                      
       y1      y2      y3      y4     
       0  1    0  1    0  1    0  1   
 w1 0  47 35   52 30   49 33   80 2   
    1   5  6    4  7   10  1   11 0   
 w2 0  49 35   52 32   51 33   82 2   
    1   3  6    4  5    8  1    9 0   
 w3 0  51 37   54 34   55 33   86 2   
    1   1  4    2  3    4  1    5 0   

MRCV documentation built on May 2, 2019, 3:46 a.m.