[R] Dummies multiplied with other variable

Andreas Goesele Goesele at hfph.mwn.de
Wed Nov 29 23:50:29 CET 2006


"David Barron" <mothsailor at googlemail.com> writes:

> Is this what you want?
>
> lm(y ~ fd + fd:y)

Thanks for you fast reply. But it's not what I wanted.

To make it clearer I have to correct the first part of what I wrote:

> On 29/11/06, Andreas Goesele <Goesele at hfph.mwn.de> wrote:

>> I would like to estimate something like y = a + b*d2*y + c*d3*y
>> where the dummies are created from some vector d with three
>> (actually many more) levels using factor(). But either there is
>> included the variable y or d1*y. How could I get rid of these?

This should have been something like:

x = a + b1*d2 + b2*d3 + c1*d2*y + c1*d3*y

When I change your suggestion to lm(x ~ fd + fd:y) I get the same as
for lm(x ~ fd*y - y), namely:

Coefficients:
(Intercept)         fd2         fd3       fd1:y       fd2:y       fd3:y
      2.4231      9.5769      6.1822     -0.1154     -1.0000     -0.4474

What I want is:

Coefficients:
(Intercept)         fd2         fd3       fd2:y       fd3:y

Thanks a lot again!

Andreas Goesele

-- 
Andreas Gösele                   Omnis enim res, quae dando non deficit,
Inst. f. Gesellschaftspolitik    dum habetur et non datur,
Kaulbachstr. 31a, 80539 München  nondum habetur, quomodo habenda est.
E-mail: goesele at hfph.mwn.de      (Augustinus)



More information about the R-help mailing list