betafunctions

Functions for two- and four-parameter Beta distributions and for estimating the accuracy and consistency of classifications based on test scores.

Installation

install.packages("betafunctions")

# Development version:
# install.packages("remotes")
remotes::install_github("HaakonEidemHaakstad/betafunctions")

Classification accuracy and consistency

Three single-administration approaches are implemented. Each has a function for one cut-point (.CA), one for several cut-points (.CA.MC), and an ROC function (.ROC):

Approach Functions Input Model
Livingston and Lewis (1995) LL.CA(), LL.CA.MC(), LL.ROC() Total scores and a reliability coefficient Four- (or two-) parameter Beta true scores, Binomial errors on the effective-test-length scale
Hanson and Brennan (Hanson, 1991) HB.CA(), HB.CA.MC(), HB.ROC() Sum scores, test length and a reliability coefficient Four- (or two-) parameter Beta true scores, Lord’s two-term compound-Binomial errors
Multinomial / compound multinomial (Lee, 2007; Lee, Brennan & Wan, 2009) MN.CA(), MN.CA.MC(), MN.ROC() Item scores, optionally in weighted item sets Examinee-level multinomial errors; no true-score distribution
library(betafunctions)

# 1000 examinees, 20 dichotomous items.
set.seed(1234)
p <- rBeta.4P(1000, 0.15, 0.85, 6, 4)
items <- sapply(1:20, function(i) rbinom(1000, 1, p))
scores <- rowSums(items)

# Livingston and Lewis, with coefficient alpha as the reliability estimate.
LL.CA(scores, reliability = cba(items), cut = 10, min = 0, max = 20)

# Hanson and Brennan, three categories, with results conditional on each score.
HB.CA.MC(scores, reliability = cba(items), cut = c(8, 12), testlength = 20,
         conditional = TRUE)

# Compound multinomial (MULT-CLASS), with Brennan and Lee's bias correction.
MN.CA(items, cut = 10)

# Category-specific indices in one table.
MC.out.tabular(MN.CA.MC(items, cut = c(8, 12)))

The .CA functions return the confusion matrix and accuracy statistics (sensitivity, specificity, predictive values, Youden’s J, accuracy) and the consistency matrix with agreement, chance agreement and Kappa. The LL and HB functions also report a chi-square test of model fit. mdlfit.gfx() plots observed against expected frequencies.

Distributions and estimation

Functions deprecated in version 2.0.0 are listed in ?"betafunctions-deprecated".

References

License

CC0. Bug reports and suggestions: https://github.com/HaakonEidemHaakstad/betafunctions/issues.