classicaltest: Classical test theory item and person statistics

View source: R/classicaltest.R

classicaltestR Documentation

Classical test theory item and person statistics

Description

Calculates several item and person statistics following ctitem(), and ctperson().

Usage

classicaltest(
  x,
  key = NULL,
  categories = NULL,
  wt = NULL,
  listwise = FALSE,
  recScore = TRUE,
  administered = NULL
)

Arguments

x

a data frame or matrix. For multiple choice items, columns can be numeric or strings and keys should be provided. For polytomous items, all columns should be numeric.

key

a vector indicating the keys to score the data. If NULL items are assumed as polytomous. Default is NULL.

categories

a vector indicating all possible categories. If NULL, this vector will be created with all the non-NA values present in x. Default is NULL.

wt

a numeric vector of total weights. Default is NULL.

listwise

only consider complete data (remove rows with NAs). Defaulft is FALSE.

recScore

a logical value indicating if the total score for should be calculated based only on valid values. Thus, if TRUE: rowMeans(x,na.rm = TRUE)*apply(x,1L,function(k) sum(!is.na(k))); if FALSE: rowMeans(x,na.rm = TRUE)*ncol(x). Defaulft is TRUE. If listwise, this argument is meaningless.

administered

a logical matrix indicating which items where administered. The dimensions should be the same as x. If NULL all items are considered administered.

Value

A list with item and person statistics.

Examples

data(dichodata)
data(polydata)
data(dichokey)

# Data preparation
## Random weights creation
set.seed(1919)
wt <- sample(x = 1:4, size = nrow(dichodata), replace = TRUE)

# Item and person analysis for multiple choice items
classicaltest(x = dichodata, key = dichokey, categories = c('A','B','C','D'), wt = wt)

# Item and person analysis for polytomous items
classicaltest(x = polydata, key = NULL, wt = wt)


classicaltest documentation built on Oct. 28, 2024, 5:06 p.m.