ordPens: Selection and/or Smoothing and Principal Components Analysis for Ordinal Variables

We provide selection, and/or smoothing/fusion of ordinally scaled independent variables using a group lasso or generalized ridge penalty. In addition, nonlinear principal components analysis for ordinal variables is offered, using a second-order difference penalty.

Also, ANOVA with ordered factors is provided by the function ordAOV; testing for differentially expressed genes can be done using ordGene. For details cf. Gertheiss (2014) and Sweeney et al. (2015), respectively.

For smoothing, selection and fusion, details may be found in Tutz and Gertheiss (2014, 2016). All functions are documented in detail in vignette("ordPens", package = "ordPens"). For smoothing only, the package also builds a bridge to mgcv::gam(), see Gertheiss et al. (2022) for further information.

For the function implementing nonlinear principal components analysis, ordPCA, details can be found in Hoshiyar et al. (2021) and vignette("ordPCA", package = "ordPens").

Version 1.1.0 is a minor release with new functions:

Version 1.0.0 is a major release with new functions:

Installation & getting started

For standard use, install ordPens from CRAN:


The development version of the package may be installed from GitHub:

devtools::install_git("https://github.com/ahoshiyar/ordPens", build_vignettes = TRUE)

For a detailed overview about the functionalities and given examples type:

vignette("ordPens", package = "ordPens")
vignette("ordPCA", package = "ordPens")


If you encounter any bugs or have any specific feature requests, please file an issue.

Contributions & Code of conduct

Contributions are very welcome. Interested contributors should consult the contribution guidelines prior to submitting a pull request.

Please note that the ordPens package is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.