Statalist The Stata Listserver


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

st: mata structu and Bill Gould


From   "U.A.QU.AP" <[email protected]>
To   [email protected]
Subject   st: mata structu and Bill Gould
Date   Wed, 18 Oct 2006 01:03:50 +0200 (CEST)

Many thanks to Kit Baum, Ben Jann and Bill Gould for detailed answers for my question "mata: how function can return several results". firstly sorry for my english
After several months using (almost exclusively ) Mata, a modest opinion (of a simple user and bad programmer like me) is that Mata is very easy to learn and to understand it's logic except for struct!!
I hope that in the forthcoming Bill's mata book and/or netcourse a good and very long chapter (especially sevreal empirical examples)  on struct will be reserved in order to "complete" our undrstand of Mata language.
Sincerely
AbdelRahmen El Lahga


---- Message original----
>Date: Mon, 16 Oct 2006 09:19:00 +0200
>From: "Ben  Jann" <[email protected]>
>Subject: st: RE: mata: how function can return several results
>To: <[email protected]>
>
>See
>
> http://www.stata.com/statalist/archive/2006-06/msg00306.html
>
>ben
>
>> -----Original Message-----
>> From: [email protected] [mailto:owner-
>> [email protected]] On Behalf Of U.A.QU.AP
>> Sent: Sunday, October 15, 2006 3:03 AM
>> To: [email protected]
>> Subject: st: mata: how function can return several results
>>
>> I would like to write a subroutine in mata that can return a several
>> result a once. More precisely if I define a function (myreg for
>exemple )
>> defined as
>> -------------start myreg
>> function myreg () {
>>
>> st_view(y, .,  st_local("yvar"))
>> st_view(x, ., st_local("xvar"))
>> bhat=invsym(x'*x)x'*y   // estimated coefficient
>> uhat=y-x*bhat       // residual
>> }
>> ----------- finish myreg
>> how can i tell mata to return 2 results
>> res1=bhat and res2=uhat. res1 and res2 are for use in the rest of my
>> programme.
>> Ideally I want some thing like this:
>> {b,u}=myreg() as can i code in gauss for exemple
>> Abdelrahmen El Lahga
>> *
>> *   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/
*
*   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