[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   Thu, 1 May 2008 20:05:22 +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. 

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). 

Hope this helps,

*------------ 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 )

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

Yahoo! For Good. Give and get cool things for free, reduce waste and help our planet. Plus find hidden Yahoo! treasure
*   For searches and help try:

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