1
$\begingroup$

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.

$\endgroup$
6
  • $\begingroup$ How about adding a pi_0 with X_0=0, and using the technique for the coefficients totaling 1? $\endgroup$ Jul 30 '14 at 15:17
  • 5
    $\begingroup$ There are many possible solutions, but choosing an appropriate one depends on understanding what $Y$ represents, on why these coefficients must lie on a simplex, and on the likely form of the errors. Could you include such information in edits to the question? $\endgroup$
    – whuber
    Jul 30 '14 at 15:21
  • $\begingroup$ @Aaron that makes sense, but in practice won't ${\pi}_{0}$ just be assigned as 0? $\endgroup$ Jul 30 '14 at 18:00
  • $\begingroup$ @whuber for the moment I'm justing trying this with randomly generated matrices to see if I can get it to work. In practice, I'd like to apply it to some biological population data. $\endgroup$ Jul 30 '14 at 18:06
  • $\begingroup$ Some tests I have done with simulated data indicate that a simple approach works extremely well when the posited model is the correct one--even when $n$ is large, the variance of $\epsilon$ is large, and there are not much data. This approach (a) includes an intercept term to account for the mean effect of the "other source", (b) applies ordinary least squares to develop initial estimates, and (c) forcibly renormalizes the coefficients to be positive and sum to unity. If this naive method does not work with your data, how exactly does it fail? $\endgroup$
    – whuber
    Jul 30 '14 at 19:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.