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.
cvx.lse.reg(t, z, w = NULL,...)
# S3 method for cvx.lse.reg
plot(x, diagnostics = TRUE,
ylab = quote(y ~ "and" ~ hat(y) ~ " values"),
pch = "*", cex = 1, lwd = 2, col2 = "red", ablty = 4, ...)
# S3 method for cvx.lse.reg
print(x, digits = getOption("digits"), ...)
# S3 method for cvx.lse.reg
predict(object, newdata = NULL, deriv = 0, ...)An object of class cvx.lse.reg, basically a list including the elements
sorted t values provided as input.
corresponding z values in input.
corresponding fit values of same length as that of x.values.
corresponding values of the derivative of same length as that of x.values.
number of steps taken to complete the iterations.
residuals obtained from the fit.
minimum value of the objective function attained.
a numeric indicating the convergence of the code.
a numeric vector giving the values of the predictor variable.
a numeric vector giving the values of the response variable.
an optional numeric vector of the same length as t; Defaults to all elements \(1/n\).
additional arguments.
for the plot() method; if true, as by
default, produce diagnostics, notably residual plots additionally.
further optional argument to the
plot() method; the last two for the color and line type of
some plot components.
the number of significant digits, for numbers in the
print() method.
an object of class "cvx.lse.reg".
a matrix of new data points in the predict function.
a numeric either 0 or 1 representing which derivative to evaluate.
Arun Kumar Kuchibhotla
The function minimizes $$\sum_{i=1}^n w_i(z_i - \theta_i)^2,$$ subject to $$\frac{\theta_2 - \theta_1}{t_2 - t_1}\le\cdots\le\frac{\theta_n - \theta_{n-1}}{t_n - t_{n-1}},$$ for sorted \(t\) values (and \(z\) permuted accordingly such that \((t_i, z_i)\) stay pairs.
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 package nnls
for the same purpose.
The plot method provides a scatterplot along with the fitted
curve; it also includes some diagnostic plots for residuals.
The predict() method allows computation of the first
derivative.
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.
args(cvx.lse.reg)
x <- runif(50,-1,1)
y <- x^2 + rnorm(50,0,0.3)
cvxL <- cvx.lse.reg(x, y)
print(cvxL)
plot(cvxL)
predict(cvxL, newdata = rnorm(10,0,0.1))
Run the code above in your browser using DataLab