[R-SIG-Finance] constrained OLS regression
Gabor Grothendieck
ggrothendieck at gmail.com
Tue Dec 30 04:53:21 CET 2008
There is an example in the Examples section of the help page: ?lm
On Mon, Dec 29, 2008 at 10:40 PM, Bastian Offermann
<bastian2507hk at yahoo.co.uk> wrote:
> Hi,
>
> does anybody know how to run a constrained OLS regression where the
> intercept is 0.
>
> r = a + b * y + e
>
> a = 0
>
> ??
>
> The following was suggested for a different example, but i dont quite know
> how to transfer this to my problem:
>
> """""""""""""I don't know STATA, but if you want to force a specific
> regression coefficient to be 1, I think that can be done with the formula.
> Consider the following:
> DF <- data.frame(x1=1:6, x2=rep(1:2, 3), y=rep(1:3, 2))
> lm(y-x1~x2-1, DF)
>
> The formula "y-x1~x2-1" fits a noconstant model, specified by the "-1"
> of y-x1 regressed on x2.
> Does this answer the question? spencer graves"""""""""""""""""""""""
>
>
>
> Thanks in advance.
>
> Regards
>
> _______________________________________________
> R-SIG-Finance at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only.
> -- If you want to post, subscribe first.
>
More information about the R-SIG-Finance
mailing list