Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# Re: st: How to return regression results from a complex column vector in mata back to stata

 From Christophe Kolodziejczyk To statalist@hsphsun2.harvard.edu Subject Re: st: How to return regression results from a complex column vector in mata back to stata Date Wed, 3 Aug 2011 10:19:23 +0200

```I've been a bit too quick in reading mm_smatlist()'s help. And you're
right it works only for real matrices. But you could get some
inspiration from _mm_matlist source code to do the same with complex
matrices.
Austin's suggestion is probably the closest to what you want to
achieve. I don't think there is a loss of efficiency sending output
back and forth from Mata/Stata, especially if the number of times is
limited.
Another solution, a bit old-fashionned, could be to print your results
in a file directly from Mata.

> Hi Christophe,
>
> matrices/vectors. My preferred solution would be to have the results
> column vector in Stata again but if there is no way of doing this with
> complex vectors/matrices I guess mata will have to do.
> Hopefully some of the mata-wizzards are reading this, but thanks again!
>
> Best,
>
> Ben
>
>
> On Tue, Aug 2, 2011 at 6:18 PM, Christophe Kolodziejczyk
> <ck.statalist@gmail.com> wrote:
>> Have your tried mm_smatlist() from the moremata package? I have not
>> tried, but maybe it is possible to display complex values with it (the
>> function is for string matrices)
>> Christophe
>>
>>> Dear statalisters,
>>>
>>> currently I am modifying a liml-like estimator in mata. In one of the
>>> final steps this involves multiplication with a complex scalar (not
>>> symmetric, but has real eigenvalues) which finally causes the
>>> estimation results to be a complex column vector. Thus
>>> st_matrix("name", mat) will not work as it cannot be used with strings
>>> or complex numbers and returns the error message: 3253  nonreal found
>>> where real required
>>> Now I have tried to use locals or macros to move the results from mata
>>> to stata and I tried to create a new variable to store the results
>>> using st_store, though this didn't work either.
>>>
>>> Essentially what I would like to do in the end is to display the
>>> column vector of results (with it's standard errors (V), t-statistics
>>> and confidence intervalls) nicely in the fashion of: ereturn post b V
>>> I can see the results in mata by typing the name of the results-column
>>> vector, though it would be nicer to go back to stata and have the
>>> usual regression output table. If anyone knows a solution to this it
>>> would be fantastic.
>>>
>>> Best,
>>>
>>> Ben
>>> *
>>> *   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/
>>
>
> *
> *   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/
```