Functions for working with two- and four-parameter Beta
distributions and the closely related Beta-Binomial distribution, and for
estimating the accuracy and consistency of test-based classifications.
Includes d/p/q/r functions for four-parameter Beta distributions,
including parameterization by mean and variance; d/p/r functions for
Beta-Binomial distributions and for Lord's two-term approximation to the
compound Binomial distribution; moments of Beta, Binomial, Beta-Binomial,
and observed-score distributions; and method-of-moments fitting of two- and
four-parameter Beta true-score distributions. Classification accuracy and
consistency can be estimated with the 'Livingston and Lewis' approach
(Livingston and Lewis, 1995
Functions for two- and four-parameter Beta distributions and for estimating the accuracy and consistency of classifications based on test scores.
install.packages("betafunctions")
# Development version:
# install.packages("remotes")
remotes::install_github("HaakonEidemHaakstad/betafunctions")
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.
dBeta.4P(), pBeta.4P(), qBeta.4P(), rBeta.4P(), and the mean-variance parameterization dBetaMS(), pBetaMS(), qBetaMS(), rBetaMS().dBetaBinom(), pBetaBinom(), rBetaBinom().dcBinom(), pcBinom(), rcBinom(), dBetacBinom(), rBetacBinom().betamoments(), binomialmoments(), betabinomialmoments(), observedmoments().Beta.4p.fit(), Beta.2p.fit(), and true-score fits Beta.tp.fit() (LL) and HB.beta.tp.fit() (HB).cba()) and McDonald's omega (mdo(), maximum likelihood by default); effective test length (ETL()) and Lord's k (Lords.k()).Functions deprecated in version 2.0.0 are listed in ?"betafunctions-deprecated".
CC0. Bug reports and suggestions: https://github.com/HaakonEidemHaakstad/betafunctions/issues.