I've seen a few similar questions about constraining coefficients so they sum to 1, but I'm not sure if there's a simple change in these approaches to allow the sum to be anything in [0,1]. I need to implement this in R.
How do I fit a constrained regression in R so that coefficients total = 1?
Constrained linear regression through a specified point
The data sets I'm doing the regression on vary in size, so my model looks something like this: $Y = {\pi}_{1}{X}_{1}+{\pi}_{2}{X}_{2}+...+{\pi}_{n}{X}_{n}+\epsilon \quad s.t. \quad \sum_{i=1}^{n}{\pi}_{i} \le 1$ and ${\pi}_{i} \ge 0 \quad \forall i$
Before I realized I needed these constraints, I was using quadratic programming, finding $min||Y - (\sum_{i=1}^{n}{\pi}_{i}{X}_{i})||^{2}$
Thanks!
Edit: I'm not sure that what I'm doing actually has any validity, I'm just experimenting at the moment. Essentially it's sort of a mixture model where $Y$ has contributions from ${X}_{1}...{X}_{n}$ and then from some other source, and I want to see if I can estimate what proportion of Y comes from any X. The reason they don't necessarily sum to 1 is because of that unknown other source. Again, I'm just experimenting, so not sure if this will even work, just curious.