# Convex Least Squares Regression.

### Description

This function provides an estimate of the non-parametric regression function with a shape constraint of convexity and no smoothness constraint. Note that convexity by itself provides some implicit smoothness.

### Usage

1 2 3 4 5 6 7 8 9 |

### Arguments

`t` |
a numeric vector giving the values of the predictor variable. |

`z` |
a numeric vector giving the values of the response variable. |

`w` |
an optional numeric vector of the same length as t; Defaults to all elements |

`...` |
additional arguments. |

`x` |
An object of class ‘cvx.lse.reg’. This is for plot and print function. |

`object` |
An object of class ‘cvx.lse.reg’. |

`newdata` |
a matrix of new data points in the predict function. |

`deriv` |
a numeric either 0 or 1 representing which derivative to evaluate. |

### Details

The function minimizes

*∑_{i=1}^n w_i(y_i - θ_i)^2*

subject to

*\frac{θ_2 - θ_1}{x_2 - x_1}≤\cdots≤\frac{θ_n - θ_{n-1}}{x_n - x_{n-1}}*

for sorted *x* values and *y* reorganized such that *y_i* corresponds to the new sorted *x_i*. This function previously used the `coneA`

function from the `coneproj`

package to perform the constrained minimization of least squares. Currently, the code makes use of the `nnls`

function from `nnls`

package for the same purpose. `plot`

function provides the scatterplot along with fitted curve; it also includes some diagnostic plots for residuals. Predict function now allows computation of the first derivative.

### Value

An object of class ‘cvx.lse.reg’, basically a list including the elements

`x.values` |
sorted ‘x’ values provided as input. |

`y.values` |
corresponding ‘y’ values in input. |

`fit.values` |
corresponding fit values of same length as that of ‘x.values’. |

`deriv` |
corresponding values of the derivative of same length as that of ‘x.values’. |

`iter` |
number of steps taken to complete the iterations. |

`residuals` |
residuals obtained from the fit. |

`minvalue` |
minimum value of the objective function attained. |

`convergence` |
a numeric indicating the convergence of the code. |

### Author(s)

Arun Kumar Kuchibhotla, arunku@wharton.upenn.edu

### Source

Lawson, C. L and Hanson, R. J. (1995). Solving Least Squares Problems. SIAM.

### References

Chen, D. and Plemmons, R. J. (2009). Non-negativity Constraints in Numerical Analysis. Symposium on the Birth of Numerical Analysis.

Liao, X. and Meyer, M. C. (2014). coneproj: An R package for the primal or dual cone projections with routines for constrained regression. Journal of Statistical Software 61(12), 1 – 22.

### Examples

1 2 3 4 5 6 7 | ```
args(cvx.lse.reg)
x <- runif(50,-1,1)
y <- x^2 + rnorm(50,0,0.3)
tmp <- cvx.lse.reg(x, y)
print(tmp)
plot(tmp)
predict(tmp, newdata = rnorm(10,0,0.1))
``` |