[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Matrix manipulation.

From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: Matrix manipulation.
Date   Fri, 2 May 2008 06:50:06 +0100 (BST)

--- Victor Mauricio Herrera <[email protected]> wrote:
> > > I'm running a regression model and then using the matrix of
> > > coefficients e(b) for additional calculations. In the model I
> > > have an interaction term between two dichotomous variables (i.e.
> > > gender-by-obesity, with women coded as 0 and men coded as 1).
> > > The coefficient for obesity in women is already in e(b) but not
> > > the coefficient for obesity in men. I know I can easily
> > > calculate this coefficient using lincom, but the problem is that
> > > I need to add the coefficient for obesity in men as an additional
> > > column to the e(b) matrix, to be able to do additional
> > > calculations using e(b). In not very familiar with matrix
> > > manipulation and I wonder if there is an easy way to do this. 

--- Maarten buis wrote:
> >  The best way is to change the variables you add to your model
> > instead of the coefficient matrix. In the example below you get
> > the coefficient of south (in your case obesity) for college
> > graduates (in your case women) in the coefficient of
> > southXcollgrad, and the coefficient of south of non-college
> > graduates (in your case men) in the coefficient of southXnoncoll.
> > Notice that in this case we leave out the main effect of south
> > (in your case obesity). 

> >  *------------ begin example ------------
> >  sysuse nlsw88, clear
> >  gen noncoll = !collgrad
> >  gen southXcollgrad = south*collgrad
> >  gen southXnoncoll = south*noncoll
> >  gen ln_w = ln(wage)
> >  reg ln_w southXcollgrad southXnoncoll collgrad noncoll, nocons
> >  *------------ end example ---------------
> >  (For more on how to use examples I sent to the Statalist, see
> > )

--- Victor Mauricio Herrera <[email protected]> wrote:
> Marteen's suggestion is well appreciated. However, variables defined
> in this way tend to be collinear and are dropped from the regression
> model, leading to non-existing coefficients and non-conformable
> matrices.

If you execute the example I have given, as is discussed in , than you will
see that that is not the case.

The most likely mistake would be that you have kept in the main effect.
As I warned you, you should leave that out in this case. Under normal
circumstances (two dummies and an interaction), the coefficient of
obesity would measure the effect of obesity for women, and the
interaction would measure how much the effect of men differs from the
effect of women. In case of the example I have given (two interaction
effect obesity X men and obesity X women) you have the effect of
obesity for men and the effect of obesity for women. Now there can no
longer be a main effect: what would that be supposed to measure?

-- Maarten

Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting address:
Buitenveldertselaan 3 (Metropolitan), room Z434

+31 20 5986715

Sent from Yahoo! Mail.
A Smarter Email
*   For searches and help try:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index