tam_downcode: Downcoding an Item Response Dataset

Description Usage Arguments Value Examples

View source: R/tam_downcode.R

Description

Recodes item categories in a data frame such that each item has values 0,1,…,K_i.

Usage

1

Arguments

dat

Data frame containing item responses

Value

List with following entries

dat

Recoded dataset

rec

Recoding table

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#############################################################################
# EXAMPLE 1: Downcoding in a toy example
#############################################################################

#-- simulate some toy data
set.seed(989)
# values to be sampled
vals <- c(NA, 0:6)
# number of persons and items
N <- 10; I <- 5
dat <- as.data.frame(matrix(NA, nrow=N, ncol=I))
colnames(dat) <- paste0("I",1:I)
for (ii in 1L:I){
    dat[,ii] <- sample(vals, size=N, replace=TRUE)
}

#-- apply downcoding
res <- TAM::tam_downcode(dat)
dat <- res$dat   # extract downcoded dataset
rec <- res$rec   # extract recoded table

TAM documentation built on June 25, 2021, 5:13 p.m.