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

View source: R/BLfour.R

item.response.tableR Documentation

Create an Item Response Table or Data Frame

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

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 tables:tabular() function 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

# 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

MRCV documentation built on Oct. 22, 2024, 5:06 p.m.