Learn R Programming

cols (version 1.5)

Lower and upper bound constrained least squares: Constrained least squares

Description

Lower and upper bound constrained least squares

Usage

int.cls(y, x, lb, ub)
int.mcls(y, x, lb, ub)

Value

A list including:

be

A numerical matrix with the constrained beta coefficients.

mse

A numerical vector with the mean squared error.

Arguments

y

The response variable. For the int.cls() a numerical vector with observations, but for the int.mcls() a numerical matrix .

x

A matrix with independent variables, the design matrix.

lb

A vector or a single value with the lower bound(s) in the coefficients.

ub

A vector or a single value with the upper bound(s) in the coefficients.

Author

Michail Tsagris.

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.

Details

This function performs least squares under the constraint that the beta coefficients lie within interval(s), i.e. \(min \sum_{i=1}^n(y_i-\bm{x}_i^\top\bm{\beta})^2\) such that \(lb_j\leq \beta_j \leq ub_j\).

See Also

pls

Examples

Run this code
x <- as.matrix( iris[1:50, 1:4] )
y <- rnorm(50)
int.cls(y, x, -0.2, 0.2)

Run the code above in your browser using DataLab