An R package for implementing the Control Polygon Reduction model selection method. When we are tasked with modeling the functional relationship between a response and a continuous predictor, i.e., y = f(x), CPR allows for quick and efficient searching of a large model space to find B-spline estimates of the function f(x).
CPR extends to multiple dimensions and allows one to find good locations for knots in a tensor product of B-splines.
This model selection method was developed as part of Peter DeWitt's PhD dissertation work. It has been extended since.
There are two vignettes within the package
vignettes(topic = 'cpr', package = 'cpr')
vignettes(topic = 'cnr', package = 'cpr')
You can also read these on package website
@inproceedings{,
author = {DeWitt, Peter E. and Carlson, Nichole E. and Samantha MaWhinney},
title = {Parsimonious B-spline Regression Models via Control Polygon Reduction},
booktitle = {Abstracts for the XXVIIIth International Biometric Conference},
month = {July},
year = {2016},
organization = {International Biometric Society},
address = {Victoria, British Columbia},
isbn = {978-0-9821919-4-1}
}
Awards: The presentation of the work earned Peter DeWitt two awards:
Install from the Comprehensive R Archive Network (CRAN)
# within R
install.packages("cpr", repos = "https://cran.rstudio.com")
If you are working on a Windows machine you will need to have Rtools installed.
This will require you to have remotes package installed.
# Just the package without the manual and without vignettes
remotes::install_github(repo = "dewittpe/cpr")
# Install with vignettes
remotes::install_github(
repo = "dewittpe/cpr"
, dependbuild_vignettes = TRUE
, dependencies = TRUE
)
You'll need to have the R package devtools installed on your machine.
To check R dependencies before building, or after you get errors due to missing R packages run:
devtools::install_dev_deps()
To build the R package and install the dev version on you machine:
make install
Alternatively, you should be able to build and install without make
R CMD build <path to cloned repo>
R CMD INSTALL cpr_<version>.tar.gz
The cpr
package provides 3D graphics via the
rgl
package. If you are get an
error, or rather message, of the form:
font family "sans" not found, using "bitmap"
Then there is an easy fix. You need to get the FreeType 2 font engine.
On Debian, you can get the library via:
apt-get install libfreetype6-dev
Once the FreeType 2 font engine has been installed on your computer you must
reinstall the rgl
package.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.