View source: R/regression_models.R
Constrained least squares | R Documentation |
Constrained least squares.
cls(y, x, R, ca)
y |
The response variables, a numerical vector with observations. |
x |
A matrix with independent variables, the design matrix. |
R |
The R vector that contains the values that will multiply the beta coefficients. See details and examples. |
ca |
The value of the constraint, |
This is described in Chapter 8.2 of Hansen (2019). The idea is to inimise the sum of squares of the residuals under the constraint R^T \beta = c
.
As mentioned above, be careful with the input you give in the x matrix and the R vector.
A list including:
bols |
The OLS (Ordinary Least Squares) beta coefficients. |
bcls |
The CLS (Constrained Least Squares) beta coefficients. |
Michail Tsagris.
R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.
Hansen, B. E. (2022). Econometrics, Princeton University Press.
gee.reg, bic.regs, ztp.reg
x <- as.matrix( iris[1:50, 1:4] )
y <- rnorm(50)
R <- c(1, 1, 1, 1)
cls(y, x, R, 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.