[R] Restricted Least Squares
Greg Snow
Greg.Snow at imail.org
Tue Aug 19 17:46:12 CEST 2008
Nelson,
It sounds like you should create a factor (or some factors) for your dummy variables, then use contr.sum to automatically create the dummy variables for you such that the coeficients would sum to 0. See ?C, ?contrasts,
?contr.sum, and ?dummy.coef for details.
--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
(801) 408-8111
> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of Nelson Villoria
> Sent: Saturday, August 16, 2008 9:20 AM
> To: Prof Brian Ripley
> Cc: r-help at r-project.org
> Subject: Re: [R] Restricted Least Squares
>
> Thank you very much Dr. Brian -- I appreciate your response.
> I understand the idea of building the constraints into the
> equation but my problem is that i have to deal with
> potentially hundreds of dummy variables, and I want the sum
> of their estimates to equal zero, so LS can be fitted with an
> intercept and a singular X'X matrix - moreover, in different
> regressions the number of dummies is also potentially
> different so i was hoping to use some restrictions of the
> form R*beta = 0, where R is the matrix of restrictions and
> beta the dummy parameters. I have written my own estimator
> based on Greene and Seeks (REView of Economics and
> STATistics, 1991), but wanted to know if there was a package
> out there making things easier.
>
> Nelson Villoria
>
> On Sat, Aug 16, 2008 at 2:24 AM, Prof Brian Ripley
> <ripley at stats.ox.ac.uk> wrote:
> > On Sat, 16 Aug 2008, Nelson Villoria wrote:
> >
> >> Dear R experts:
> >>
> >> Is there any package that estimates Restricted Least Squares?
> >>
> >> Specifically, If I want to fit:
> >>
> >> G = b0 + b1(Y) + a1(X1) + a2(X2) + a3(X3) + a4(X4) where
> Y, X1 to X4
> >> are variables and b's and a's parameters to be estimated.
> >>
> >> I want to impose a1 + a2 + a3 + a4 = 0.
> >
> > You don't need a package to do that, just re-parametrize. It is
> >
> > G ~ Y + I(X1-X4) + I(X2-X4) + I(X3-X4)
> >
> > --
> > Brian D. Ripley, ripley at stats.ox.ac.uk
> > Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
> > University of Oxford, Tel: +44 1865 272861 (self)
> > 1 South Parks Road, +44 1865 272866 (PA)
> > Oxford OX1 3TG, UK Fax: +44 1865 272595
> >
>
> ______________________________________________
> 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