cvx.lip.reg: Convex Least Squares Regression with Lipschitz Constraint

Description Usage Arguments Details Value Author(s) Source References See Also Examples

View source: R/CvxLipReg.r

Description

This function provides an estimate of the non-parametric regression function with a shape constraint of convexity and a smoothness constraint via a Lipschitz bound.

Usage

1
2
3
4
5
6
7
8
9
cvx.lip.reg(t, z, w = NULL, L,...)
## Default S3 method:
cvx.lip.reg(t, z, w = NULL, L, ...)
## S3 method for class 'cvx.lip.reg'
plot(x,...)
## S3 method for class 'cvx.lip.reg'
print(x,...)
## S3 method for class 'cvx.lip.reg'
predict(object, newdata = NULL, deriv = 0, ...)

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 x; Defaults to all elements 1/n.

L

a numeric value providing the Lipschitz bound on the function.

...

additional arguments.

x

an object of class ‘cvx.lip.reg’.

object

An object of class ‘cvx.lip.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(z_i - θ_i)^2

subject to

-L≤\frac{θ_2 - θ_1}{t_2 - t_1}≤\cdots≤\frac{θ_n - θ_{n-1}}{t_n - t_{n-1}}≤ L

for sorted t values and z reorganized such that z_i corresponds to the new sorted t_i. This function uses the nnls function from the nnls package to perform the constrained minimization of least squares. plot function provides the scatterplot along with fitted curve; it also includes some diagnostic plots for residuals. Predict function now allows calculating the first derivative also.

Value

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

x.values

sorted ‘t’ values provided as input.

y.values

corresponding ‘z’ 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’.

residuals

residuals obtained from the fit.

minvalue

minimum value of the objective function attained.

iter

Always set to 1.

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.

See Also

See also the function nnls.

Examples

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

Example output

Loading required package: nnls
Loading required package: cobs
function (t, z, w = NULL, L, ...) 
NULL
Call:
cvx.lip.reg.default(t = x, z = y, L = 10)
Minimum Criterion Value Obtained:
[1] 0.08694414
Number of Iterations:
[1] 1
Convergence Status:
[1] 1
 [1] 0.02043385 0.02322928 0.01831447 0.01756469 0.01985495 0.01956844
 [7] 0.02832310 0.02218437 0.01964059 0.01893204

simest documentation built on May 2, 2019, 5:40 a.m.

Related to cvx.lip.reg in simest...