Programming

The epmr Package

Overview

epmr, currently under development, is a package for educational and psychological methods in R. It’s used throughout my introductory measurement book. The package supports a variety of basic statistical analyses used in measurement and psychometrics. The development version of epmr is available on github at https://github.com/talbano/epmr.

Examples

See the book for detailed demonstrations of the different functions. Examples cover:

A chapter on dimensionality is in the works. I’ll also be adding validity analyses at some point.

Most of the functionality of the package is accessed via the different “study” functions:

  • astudy: inter-rater agreement indices
  • difstudy (under development): differential item functioning
  • dstudy: basic descriptive statistics
  • gstudy: generalizability theory modeling
  • irtstudy: item response theory modeling (currently only Rasch)
  • istudy: classical item analysis
  • mstudy: a wrapper function that runs item analysis, descriptives, and reliability analysis for a scale
  • ostudy: option analysis, aka distractor analysis
  • rstudy: classical reliability analysis

The equate Package

Overview

equate is an R package for observed-score linking and equating of test scores. Here’s the official description of the package, from the CRAN site:

Contains methods for observed-score linking and equating under the single-group, equivalent-groups, and nonequivalent-groups with anchor test(s) designs. Equating types include identity, mean, linear, general linear, equipercentile, circle-arc, and composites of these. Equating methods include synthetic, nominal weights, Tucker, Levine observed score, Levine true score, Braun/Holland, frequency estimation, and chained equating. Plotting and summary methods, and methods for multivariate presmoothing and bootstrap error estimation are also provided.

In the last couple versions I’ve added some new features: some analytic standard errors, bootstrap error estimation, plotting capabilities, a general linear method, and equating with multiple anchor tests and covariates. In version 2.0-3 I also changed the way frequency tables are created and manipulated – they’re now based on the table class rather than data.frame.

The development version of the package is available on the equate github repository.

Bootstrapping

For any equating run you can request empirical or parametric bootstrap standard error, bias, and RMSE. The empirical estimates come from bootstrap resampling of the raw score distributions. Parametric estimates come from smoothed score distributions.

This will load the package and prep the data, which is referred to as KBneat.

# Load equate package
library(equate)

# KBneat data
neat.x <- freqtab(KBneat$x, scales = list(0:36, 0:12))
neat.y <- freqtab(KBneat$y, scales = list(0:36, 0:12))

# Smoothed population distributions
neat.xp <- presmoothing(neat.x, "loglinear", degrees = 2)
neat.yp <- presmoothing(neat.y, "loglinear", degrees = 2)

Then, a bit of code runs the equating, e.g., the Tucker linear method with bootstrap standard errors.

# Tucker mean equating
neat.m.t <- equate(neat.x, neat.y, type = "mean",
    method = "tucker", boot = TRUE, xp = neat.xp,
    yp = neat.yp)

Finally, this will run an entire bootstrapping study, comparing identity, linear, equipercentile, and circle-arc equating with samples of 100 at each replication.

# Set seed and create the criterion
set.seed(131031)
crit <- equate(neat.xp, neat.yp, "e", "c")$conc$yx

# Create equating arguments and run bootstrapping
neat.args <- list(i = list(type = "i"),
    lt = list(type = "lin", method = "t"),
    ef = list(type = "equip", method = "f",
        smooth = "log", degrees = 2),
    ec = list(type = "equip", method = "c",
        smooth = "log", degrees = 2),
    cc = list(type = "circ", method = "c", chainmidp = "lin"))
bootout <- bootstrap(x = neat.xp, y = neat.yp, xn = 100,
    yn = 100, reps = 100, crit = crit, args = neat.args)

Plotting

Equating output

Equating and bootstrapping objects both have corresponding plot methods for visualizing results. The first plot below compares the identity, linear, equipercentile, and circle-arc equating functions, and the second compares their bootstrap standard errors.

# Plotting equating output
plot(equate(neat.x, neat.y, "identity"),
    equate(neat.x, neat.y, "linear", "tucker"),
    equate(neat.x, neat.y, "equip", "frequency", smooth = "log", degrees = 2),
    equate(neat.x, neat.y, "equip", "chain", smooth = "log", degrees = 2),
    equate(neat.x, neat.y, "circle", "chain"),
    addident = FALSE)

# Plotting bootstrap standard errors
plot(bootout, out = "se", addident = FALSE,
    legendplace = "top")

Smoothing output

There are also plot methods for visualizing smoothing results. The plots below compare loglinear smoothing results for a univariate and bivariate distribution. The first shows smoothed curves for maximum polynomials of 2, 3, and 4; the second shows smoothed curves for the same univariate polynomials, and also the first bivariate polynomial.

# Univariate smoothing
act.x <- as.freqtab(ACTmath[, 1:2])
plot(act.x, loglinear(act.x, stepup = TRUE)[, -1])

# Bivariate smoothing
plot(neat.x, loglinear(neat.x, stepup = TRUE)[, -c(1, 5)])