<!-- README.md is generated from README.Rmd. Please edit that file -->

# *shortr*: Develop Concise but Comprehensive Shortened Versions of Psychometric Instruments

<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/shortr)](https://CRAN.R-project.org/package=shortr)
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html)
<!-- badges: end -->

## Description

*shortr* operationalizes the identification problem of which subset of items should be kept in the shortened version of a said psychometric instrument to best represent the set of items comprised in the original version of the said psychometric instrument.

## Installation

```r
utils::install.packages(pkgs = "shortr")

base::library(package = "shortr")
```

## Usage

```r
shortr::shortr(
  n.mat = lavaan::lavCor(object = DATA, ordered = TRUE), 
  k = 5, 
  algorithm = "brute.force"
)

shortr::shortr(
  n.mat = lavaan::lavCor(object = DATA, ordered = TRUE), 
  k = 5, 
  algorithm = "simulated.annealing", 
  start.temp = 1, 
  cool.fact = 0.999, 
  stop.temp = 0.001, 
  n.runs = 1000, 
  seed = 5107
)
```

## Formulation

Let $N$ denote the indices corresponding to the set of items comprised in the original version of a said psychometric instrument, and let $n = |N|$ denote its cardinality, with $n \in \mathbb{N}$. Let $i, j \in N$ denote arbitrary indices. Let $K \subset N$ denote the indices corresponding to the subset of items to be comprised in the shortened version of the said psychometric instrument, and let $k = |K|$ denote its cardinality, with $k \in \{1, \ldots, n-1\}$. Let $A = (a_{ij}) \in \mathbb{R}^{n \times n}$ denote a symmetric matrix of associations (e.g., of zero-order polychoric correlation coefficients) computed from the set of items comprised in the original version of the said psychometric instrument, satisfying $A = A^\top \Leftrightarrow a_{ij} = a_{ji}$ for all $i, j \in N$. Each element $a_{ij}$ represents an association (e.g., a zero-order polychoric correlation coefficient) between the items indexed by $i$ and $j$. Let $K^c = N \setminus K$ denote the complement of $K$ in $N$, with $|K^c| = n - k$. The objective is to identify the subset of indices $K \subset N$ of cardinality $|K| = k$ that maximizes the sum of the absolute values of the associations $a_{ij}$ for all $i \in K$ and $j \in K^c$. Formally, such an identification problem is expressed as follows:

$$
\max_{K \subset N,\ |K| = k} \sum_{i \in K} \sum_{j \in K^c} |a_{ij}|
$$

## Operationalization

To operationalize the said identification problem, we developed and released the *R* function `shortr::shortr()` of the *R* package `shortr` (Fournier et al., 2026), which is publicly shared under a *GNU General Public License* on the *Comprehensive R Archive Network* (https://doi.org/10.32614/CRAN.package.shortr).

## Citation

```r
utils::citation(package = "shortr")
```

Fournier, L., Heeren, A., Baggio, S., Clark, L., Verdejo-García, A., Perales, J. C., & Billieux, J. (2026). *shortr: Develop concise but comprehensive shortened versions of psychometric instruments* (*R* package version 1.0.3) [Computer software]. https://doi.org/10.32614/CRAN.package.shortr
