Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Questions about matrix operations


From   anirban basu <[email protected]>
To   [email protected]
Subject   Re: st: Questions about matrix operations
Date   Mon, 17 Jun 2002 14:45:36 -0500 (CDT)

Hi,

I think you want the -mat score- option...

mat bhat=e(b)
mat score xb=bhat

Remember, it will genenate a scalar for each observation. i.e. xb will be
a new variable containing values of x(i).b for observation (i).

Anirban




______________________________________
ANIRBAN BASU
Doctoral Fellow
Harris School of Public Policy Studies
University of Chicago
(312) 563 0907 (H)
________________________________________________________________


On Mon, 17 Jun 2002, Wolff wrote:

> Hey folks,
> I have a simple problem.  I have a regression with three variables.  I
> would like to create a new variable equal to the sum of the estimated
> coefficients times the variable values.  The coefficients are saved in
> the matrix e(b).  I would like to do something like newvar=e(b)'*[var1
> var2 var3].  Since e(b)' is 1X3 and the next matrix is 3X1, I thought it
> would generate a scalar.  Is there an easy way to accomplish this?
> 
> Thanks,
> Eric
> 
> 
> 
> Eric D. Wolff
> Graduate School of Industrial Administration, Room 313
> Carnegie-Mellon University
> Tech and Frew
> Pittsburgh, PA 15213
> (412) 268-2939 (office)
> (412) 268-6837 (fax)
> email: [email protected]
>  
> 
> *
> *   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index