Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: AW: how do I get a stata matrix into mata?


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: AW: how do I get a stata matrix into mata?
Date   Mon, 21 Sep 2009 17:31:37 +0200

<> 

Alternatively, construct the vector in -mata- in the first place:


*************
mata: mata clear

sysuse auto, clear

gen constant=1
capt ssc inst tomata
di in red _rc

tomata price constant weight trunk

mata
	X=(weight, trunk, constant)
	y=price
	b=invsym(X'*X)*X'*y
	b
	//for comparison:
	mata stata reg price weight trunk
end
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Miriam Wüst
Gesendet: Montag, 21. September 2009 17:21
An: statalist@hsphsun2.harvard.edu
Betreff: st: how do I get a stata matrix into mata?

 
I can only make the other way work (from mata to stata) - what if I want to
"send" a stata vector containing e(b) to mata?

Thanks!
Miriam

 

______________________________________________

MIRIAM WÜST

PHD STUDENT

 



*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   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