Re: [R-SIG-Finance] Constrained Regression with Intercept in pcls

2011-12-05 Thread Philipp
Hi Enrico, Thanks for your answer. I tried the third alternative, which I need with my two constraints. But I get the error message: Amat and dvec are incompatible! Can you help me again? Regards Phillip -- View this message in context:

[R-SIG-Finance] Constrained Regression with Intercept in pcls

2011-12-01 Thread Philipp
Dear all, I already asked about to run a constrained regression like y=b0 + b1X1+b2x2+b3x3, with constraints: b1+b2+b3=1 and b1,b2,b3=0. I thought it will run with style.QPfit with the performance Analytic packages. However the style.QPfit function does not estimate an intercept. As i really

Re: [R-SIG-Finance] Constrained Regression with Intercept in pcls

2011-12-01 Thread Enrico Schumann
Hi Philipp, you should be able to solve this with package quadprog/solve.QP. require(quadprog) p - 3## number of regressors T - 100 ## number of obs X - array(rnorm(T*p), dim = c(T,p)) X - cbind(1,X) ## add a constant y - rnorm(T) ## variant 1 -- linear regression coef(lm(y ~ -1 + X))