Hello, Your problem is y=bX+epsilon It can be transformed into: epsilon^2=(y-bX)^2
Standard (unconstrained) regressions are about minimizing the variance of epsilon, ie (y-bX)^2. In your case, you need to minimize again the quantity (y-bX)^2 with your constraints on b=(b1,...,b5). Solve.QP should just do that for you. HTH, Samuel -----Original Message----- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jackie Chen Sent: 20 January 2011 16:31 To: R-help@r-project.org Subject: [R] Constrained Regression Hi everyone, I'm trying to perform a linear regression y = b1x1 + b2x2 + b3x3 + b4x4 + b5x5 while constraining the coefficients such that -3 <= bi <= 3, and the sum of bi =1. I've searched R-help and have found solutions for constrained regression using quadratic programming (solve.QP) where the coefficients are between 0 and 1 and sum to 1, but unfortunately do not understand it well enough to adapt to my problem. Is there a way to do this using the lm function or do I absolutely need to use solve.QP? And if I need to use solve.QP, how would I modify the Boston data example to my problem? Thanks so much. Jackie --- This communication may contain confidential and/or privileged information. If you are not the intended recipient (or have received this communication in error) please notify the sender immediately and destroy this communication. Any unauthorized copying, disclosure or distribution of the material in this communication is strictly forbidden. Deutsche Bank does not render legal or tax advice, and the information contained in this communication should not be regarded as such. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __________ Information from ESET NOD32 Antivirus, version of virus signature database 5803 (20110120) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __________ Information from ESET NOD32 Antivirus, version of virus signature database 5803 (20110120) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.