bonStats / gcreg

General Constraint Regression Models
GNU General Public License v3.0
0 stars 0 forks source link
constrained-regression mixed-effects monotonicity polynomial-regression r shape-constraints

gcreg: General Constraint Regression models in R

This package is currently being developed. It's aim is to provide methods for fitting regression models with:

The paper accompanying this package is available here.

The current focus of development is on monotonicity in polynomial fixed and mixed effects models but will be extended over time to more general models and constraints.

To get started, install this package from GitHub using the devtools package:

devtools::install_github("bonStats/gcreg")
library(gcreg)

To install with vignettes you will need to install some required packages and set build_vignettes = T:

install.packages(c("rmarkdown","ggplot2","fda"))
devtools::install_github("bonStats/gcreg", build_vignettes = T)
library(gcreg)

You can start fitting constrained polynomial models with the gcreg::cpm() function. For example

library(fda)
data(onechild)
cpm(height~day, data = onechild, degree = 5, constraint = "monotone", c_region = c(1,312))

See the package vignettes for more examples: