The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
An R package implementing a version of the Supervised Principal Component regression (SPCR, Bair et al., 2006) that allows for any measurement level of the dependent and independent variables. This package builds upon the method implemented in the R package superpc
.
SPCR regresses a dependent variable onto a few supervised principal components computed from a large set of predictors. The steps followed by SPCR are the following:
A key aspect of the method is that both the number of PCs and the threshold value can be determined by cross-validation. GSPCR extends SPCR by allowing the dependent variable to be of any measurement level (i.e., ratio, interval, ordinal, nominal) by introducing likelihood-based thresholds for the univariate regressions in step 1. Furthermore, GSPCR allows the predictors to be of any type by combining the PCAmix framework (Kiers, 1991; Chavent et al., 2017) with SPCR in step 3.
The R package gspcr
allows to:
To install the latest version, run the following command in your R console:
devtools::install_github("EdoardoCostantini/gspcr")
To load the gspcr
library in an R session and start using it:
library("gspcr")
To check an example of how to use the package, call the help file for the main function:
help("cv_gspcr")
You can also read the first draft of the package vignette by opening the file ./vignettes/main-features.html
.
Check on how to cite the package with the R command:
citation("gspcr")
This software uses unit tests to test whether the functions behave as expected. These tests are performed by using the test()
function from the devtools
R package. The workflow is the one established by the testthat
R package. To run these tests:
Install the devtools
R package, if you do not have it already.
Then, you can test with the following command in the R console:
The vignettes for this package take a lot of time to compile. As a result, I adopted a two-step workflow:
.Rmd.orig
formatrebuild-vignettes.R
script to update the actual .Rmd
vignette filesWhen testing, building, uploading the package, only the .Rmd
versions of the vignettes will be compiled. These versions contain precompiled R code and plots so that the compilation time is minimized. This workflow is inspired by:
Bair E, Hastie T, Paul D, Tibshirani R (2006). “Prediction by supervised principal components.” J. Am. Stat. Assoc., 101(473), 119-137.
Chavent, M., Kuentz-Simonet, V., Labenne, A., & Saracco, J. (2014). Multivariate analysis of mixed data: The R package PCAmixdata. arXiv preprint arXiv:1411.4911.
Kiers, H. A. (1991). Simple structure in component analysis techniques for mixtures of qualitative and quantitative variables. Psychometrika, 56(2), 197-212.
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.