Bookmark and Share

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.


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

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


From   Ben Smythe <ben.solomon81@googlemail.com>
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 09:41:02 +0200

Okay, that sounds good! Though in total I would need to return 9
calculated elements from mata back to Stata to obtain the final
regression coefficients and then go back to mata to compute the
variance for the estimates. Might it be better to do all in Stata
straight away or is there no efficiency/speed loss involved in
changing back and forth between mata and Stata?
Thanks for your comment, it was a great help!

Kind regards,

Ben

On Wed, Aug 3, 2011 at 3:49 AM, Austin Nichols <austinnichols@gmail.com> wrote:
> Ben Smythe <ben.solomon81@googlemail.com>:
> Return the real and imaginary parts as two separate vectors, or a 2Xk
> matrix, or a 2kX1 vector.  If you want to post as estimation results,
> I would name each component of your complex vector as an equation in
> Stata and have two coefs per equation: Re and Im.  Then the output
> will be more readable.  Are you computing variances for these complex
> estimates?
>
> On Tue, Aug 2, 2011 at 5:21 PM, Ben Smythe <ben.solomon81@googlemail.com> wrote:
>> Hi Christophe,
>>
>> thanks for your answer. Unfortunately mm_smatlist() also requires real
>> 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
>>>
>>> 2011/8/2 Ben Smythe <ben.solomon81@googlemail.com>:
>>>> 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.
>
> *
> *   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   |   Site index