Statalist


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

Re: st: Matrix manipulation.


From   Victor Mauricio Herrera <vherrera@wisc.edu>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Matrix manipulation.
Date   Thu, 01 May 2008 23:55:57 -0500

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.

Thanks,

VICTOR M. HERRERA
PhD., Student 
Population Health Sciences
University of Wisconsin
610 Walnut St. 632 WARF
Madison, WI 53726
(608) 265-3686

----- Original Message -----
From: Maarten buis <maartenbuis@yahoo.co.uk>
Date: Thursday, May 1, 2008 2:07 pm
Subject: Re: st: Matrix manipulation.
To: statalist@hsphsun2.harvard.edu


> --- Victor Mauricio Herrera <vherrera@wisc.edu> 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,
>  Maarten
>  
>  *------------ 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
>  http://home.fsw.vu.nl/m.buis/stata/exampleFAQ.html )
>  
>  -----------------------------------------
>  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
>  
>  http://home.fsw.vu.nl/m.buis/
>  -----------------------------------------
>  
>  
>        ___________________________________________________________ 
>  Yahoo! For Good. Give and get cool things for free, reduce waste and 
> help our planet. Plus find hidden Yahoo! treasure 
>  
>  http://green.yahoo.com/uk/earth-day/
>  *
>  *   For searches and help try:
>  *   http://www.stata.com/support/faqs/res/findit.html
>  *   http://www.stata.com/support/statalist/faq
>  *   http://www.ats.ucla.edu/stat/stata/
>  
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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