[R] Linear regression with constraints on the parameters.
Moshe Olshansky
m_olshansky at yahoo.com
Tue Oct 9 06:00:16 CEST 2007
Hi Gopi,
Simple linear regression minimizes sum of squares of
the residuals. So in your case you can use Quadratic
Programming (see quadprog package) to introduce linear
constraints.
Regards,
Moshe.
--- Gopi Goswami <grgoswami at gmail.com> wrote:
> Hi there,
>
>
> Is there an existing package in R that does simple
> linear regression
> with linear constraints on the parameters? Here is
> the set up:
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> y_i = \sum_{k = 1}^K \beta_k x_k + \epsilon_i
>
> where
>
> \sum_{k = 1}^K c_k \beta_k = c_0, for some known
> constants \{ c_k \}_{k = 0}^K
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
>
>
>
> A proposed solution is to consider the following
> (with \{ d_k \}_{k =
> 0}^K that are obvious functions of \{ c_k \}_{k =
> 0}^K):
>
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> \beta_K = d_0 + \sum_{i=1}^{K-1} d_i \beta_i for
> known d_i
>
> \implies \beta_K x_K = d_0 x_K + \sum_{i=1}^{K-1}
> d_i \beta_i x_K
>
> \implies y - d_0 x_K = \beta_0 + \sum_{i=1}^{K-1}
> \beta_i (x_i + d_i x_K)
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
>
>
>
> Is there any existing package that does this? Has
> anyone used the glmc
> package to do this sort of thing? An example will be
> much appreciated.
>
>
>
> Thanks a lot,
> gopi.
>
> ______________________________________________
> R-help at 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.
>
More information about the R-help
mailing list