R code for Smoothed Shape-Restricted Regression
# SMOOTHED SHAPE-RESTRICTED LEAST-SQUARES REGRESSION

**PART I: monotone regression spline **
Given a data vector **y** in &real^{n}, and a knot specification, minimize
||**y &minus &phi**||^{2} for &phi in the set of non-decreasing piece-wise
quadratic splines with the specified knots.

The knots themselves may be specified, *or* a number of (interior) knots specified, which will
be placed at equal x quantiles.

The following code has argument y, and returns the least-squares nondecreasing solution.

### R code for monotone spline regression

**PART II: convex regression spline**
Given a scatterplot of data vector **(x,y)** where **x,y** in &real^{n},
minimize ||**y &minus &phi**||^{2}, for &phi in the set of convex piece-wise
cubic splines with the specified knots.

The knots themselves may be specified, *or* a number of (interior) knots specified, which will
be placed at equal x quantiles.

The following code has arguments **x** and **y** and returns the solution.

### R code for convex spline regression

**PART III: monotone increasing and convex regression spline**
Given a scatterplot of data vector **(x,y)** where **x,y** in &real^{n},
minimize ||**y &minus &phi**||^{2} , for &phi in the set of increasing convex piece-wise
cubic splines with the specified knots.

The knots themselves may be specified, *or* a number of (interior) knots specified, which will
be placed at equal x quantiles.

The following code has arguments **x** and **y** and returns the solution.

### R code for increasing convex spline regression

**PART IV: monotone increasing and concave regression spline**
Given a scatterplot of data vector **(x,y)** where **x,y** in &real^{n},
minimize ||**y &minus &phi**||^{2} , for &phi in the set of increasing concave piece-wise
cubic splines with the specified knots.

The knots themselves may be specified, *or* a number of (interior) knots specified, which will
be placed at equal x quantiles.

The following code has arguments **x** and **y** and returns the solution.

### R code for increasing concave spline regression

meyer@stat.colostate.edu