I am performing a returns analysis. The idea is to regress a time-series of returns on the returns of various asset classes. The beta coefficients must be constrained such that sum of the coefficients is 1 and no coefficient is less than 0 or greater than 1. These beta coefficients can then be interpreted as explaining what % of returns are explained by exposure to the various asset classes.

Are there any packages in R that let me setup the above regression and benefit from the attendant reporting on model fit statistics? Or do I need to do some homework on setting up constrained least squares optimization in R (please provide any references to recommended R packages)?

  • $\begingroup$ I've used the MGCV package to fit a constrained regression where the coefficient could not be negative: stat.columbia.edu/~tzheng/tianblog/2006/07/… $\endgroup$ – Glen Mar 7 '12 at 14:53
  • $\begingroup$ @Glen - thanks! Why don't you post your comment as an answer? $\endgroup$ – Ram Ahluwalia Mar 7 '12 at 15:02

I've used the MGCV package to fit a constrained regression where the coefficients could not be negative:

Constrained Regression

Also the 'quadprog' package with the solve.QP function may be useful.

Both, however, have a little bit of a learning curve, at least for me.


You can use ConsReg package.


It's very easy to use


Not the answer you're looking for? Browse other questions tagged or ask your own question.