Learn R Programming

MRCV (version 0.1-0)

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

Description

The item.response.table function is used to summarize data arising from two or three MRCVs. For the two MRCV case, a cross-tabulation of the positive and negative responses for each (Wi, Yj) pair is presented as a table or data frame. 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

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 binary items W1, ..., WI, Y1, ..., YJ, and Z1, ..., ZK (in this order). The third set of items is only necessary when analyz
I
The number of items corresponding to row variable W.
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 a 2Ix2J table of marginal counts (or multiple 2Ix2J tables in the case of three MRCVs). For create.dataframe = TRUE, item.response.table returns the same information as above but presents it as a data frame. For the two MRCV case, the data frame contains 2Ix2J rows and 5 columns generically named W, Y, wi, yj, and count. For the three MRCV case, the data frame contains 2Ix2Jx2K rows and 7 columns generically 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

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

# Create an item response data frame for 2 MRCVs
farmer.irdataframe <- item.response.table(data = farmer2, I = 3, J = 4, 
    create.dataframe = TRUE) 
farmer.irdataframe

# 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

Run the code above in your browser using DataLab