- #1

dansu

- 3

- 0

**[SOLVED] Multivariate Linear Regression With Coefficient Constraint**

I'm attempting a multivariate linear regression (mvlr) by method of least squares. Basically, I'm solving a matrix of the following form for [tex]\beta_p,[/tex][tex]

$ \begin{bmatrix} \sum y \\ \sum x_1 y \\ \sum x_2 y \\ \sum x_3 y \end{bmatrix} = \begin{bmatrix} n & \sum x_1 & \sum x_2 & \sum x_3 \\ \sum x_1 & \sum x_1^2 & \sum x_1 x_2 & \sum x_1 x_3 \\ \sum x_2 & \sum x_2 x_1 & \sum x_2^2 & \sum x_2 x_3 \\ \sum x_3 & \sum x_3 x_1 & \sum x_3 x_2 & \sum x_3^2 & \end{bmatrix}\begin{bmatrix} \beta_0 \\ \beta_1 \\ \beta_2 \\ \beta_3 \end{bmatrix} $\end{text}[/tex]

x are sets of data, y is the data I want to fit, and [tex]\beta[/tex] are the coefficients.

My problem is that I want to set a constraint such that [tex]\beta[/tex] remains positive. What would be a good way to achieve this?