make.incidenz {pairwise}R Documentation

Converting a booklet allocation table into a incidence matrix

Description

This function converts a booklet allocation table (like in cogBOOKLET) into a incidence matrix used in the function pers.

Usage

make.incidenz(tab, bookid, item_order = NULL, info = FALSE)

Arguments

tab

a booklet allocation table as a data.frame. The first column is assumed to contain the item names as a character vector (not a factor!) the other columns must be integer vectors containing the information in which booklet(s) the respective item is allocated.

bookid

a integer vector with the same length as the number of persons in the response data giving the information which booklet was assigned to each person.

item_order

optional a character vector with the item names in the order of the items in the response data (from first to last column in the response data). By default it is assumend that the item order in the booklet allocation table is already the same as in the response data.

info

logical default: info=FALSE to return just the incidence matrix. If set to info=TRUE more detailed information about the booklet design ist returned.

Details

It is assumed that there is an equal replicate factor for each item used, when constructing the bookletdesign - so every items occures with the same frequency over all booklets of the entire set of booklets.

Value

an incidence matrix as an object of class "matrix" with 0,1 coding or a "list" with detailed information.

Examples

#########################
data(cog);data(cogBOOKLET) # loading reponse and allocation data
table(cog$BOOKID)# show n persons per booklet
names(table(c(as.matrix(cogBOOKLET[,2:5])))) # show booklets in allocation data
d<-(cog[cog$BOOKID!=14,]) # skip persons which got booklet No.14.
inc<-make.incidenz(tab=cogBOOKLET, bookid=d$BOOKID) # make just the incidence matrix
inc  
make.incidenz(tab=cogBOOKLET, bookid=d$BOOKID, info=TRUE) # get some info too
# in this case not necessary but just to show
# using the (item) names in cog to secure the item order in incidence matrix:
make.incidenz(tab=cogBOOKLET, bookid=d$BOOKID, item_order=names(cog)[4:34])  
#######################

[Package pairwise version 0.6.1-0 Index]