Regression with equality and inequality constrained coefficients in R
I am trying to obtain estimated constrained coefficients using RSS. The beta coefficients are constrained between [0,1] and sum to 1. Additionally, my third parameter is constrained between (-1,1). Utilizing the below I can obtain a nice solution using simulated variables but when implementing the methodology on my real data set I keep arriving at a non-unique solution. In turn, I'm wondering if there is a more numerically stable way to obtain my estimated parameters. set.seed(234) k = 2 a = diff(c(0, sort(runif(k-1)), 1)) n = 1e4 x = matrix(rnorm(k*n), nc = k) a2 = -0.5 y = a2 * (x %*% a) +