Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: Antwort: Re: st: RE: matrix results saved


From   "Joao Ricardo F. Lima" <[email protected]>
To   [email protected]
Subject   Re: Antwort: Re: st: RE: matrix results saved
Date   Thu, 11 Nov 2010 13:47:27 -0300

Rodrigo,

to answer the question... "the results I want to save are in a matrix form"

*****************begin example****************
webuse klein
tsset yr
regress consump wagegovt L.consump L2.consump
estat bgodfrey, lags(2)
mat bg= r(chi2)
mat pbg = r(p)
mat li bg
mat li pbg
*****************end example****************

Joao Lima

2010/11/11 Joao Ricardo F. Lima <[email protected]>:
> Rodrigo,
>
> in this case, r(chi2) and r(p) are stored in matrixes:
>
> ***** begin example********
> webuse klein
> tsset yr
> regress consump wagegovt L.consump L2.consump
> estat bgodfrey, lags(2)
> mat li r(chi2)
> mat li r(p)
> ***** end example********
>
>
> Use -eret li- and -ret li- to know how they are stored.
>
> HTH,
>
> Joao Lima
>
>
> 2010/11/11 Rodrigo Briceño <[email protected]>:
>> Thanks Richard. Actually I tried with that option, but the thing is
>> that the results I want to save are in a matrix form, not in a scalar
>> form. So, when I used:
>>
>> estat bgodfrey, lags(12)
>> scalar bg=r (chi2)
>> scalar pbg= r(p)
>>
>> I got the type mismatch r(109) error.
>>
>> Thanks.
>>
>> 2010/11/11 Nick Cox <[email protected]>:
>>> This sounds much better than my suggestion.
>>>
>>> Nick
>>> [email protected]
>>>
>>> Richard Ochmann
>>>
>>> have you tried -estadd scalar-?
>>>
>>> ***
>>> scalar chi2s = r(chi2)
>>> scalar chi2p = r(p)
>>> estadd scalar chi2s
>>> estadd scalar chi2p
>>> estout, cells(b(star fmt(%9.3f)) se(par)) stats(chi2s chi2p)
>>> ***
>>>
>>> Rodrigo Briceño
>>>
>>>> Sorry Nick for not being so explicit.
>>>>
>>>> What I want is that these two values r1  22.942303 (chi2 statistic
>>>> saved as a matrix) and r1  .02821978 (p-value) appears below the
>>>> estout results already saved. An example of this with my first
>>>> regression:
>>>>
>>>> estout, cells(b(star fmt(%9.3f)) se(par)) stats(r2_a N hettest hetp,
>>>> fmt(%9.3f %9.0g %9.3f %9.3f)):
>>>>
>>>>                      Reg1
>>>> ----------------------------
>>>> sap                -0.238
>>>>                   (0.183)
>>>> liqmk               1.183**
>>>>                   (0.350)
>>>> ----------------------------
>>>> r2_a                0.370
>>>> N                      54
>>>> hettest            32.227
>>>> hetp                0.152
>>>> bg                  22.942303
>>>> pbg                  0.02821978
>>>>
>>>>
>>>> >
>>>> > Yesterday I posted a request about how to include
>>>> > Chi2 statistics and p-values from Breusch Godfrey Test into estout
>>>> > results. After doing an all-day research, since I'm not a Stata
>>>> > Programming expert, I discovered that Breusch Godfrey produces matrix
>>>> > results instead of scalar results (as estat hettest, for testing
>>>> > heteroskedasticity does).
>>>> >
>>>> > I also discovered that by especifying  matrix bg=r (chi2) and matrix
>>>> > pbg= r(p) I was able to save chi2 values and p-values for the test.
>>>> > When I list the results I can see something like this:
>>>> >
>>>> > matrix list bg
>>>> >
>>>> > symmetric bg[1,1]
>>>> >         lags:
>>>> >           12
>>>> > r1  22.942303
>>>> >
>>>> > matrix list pbg
>>>> >
>>>> > symmetric pbg[1,1]
>>>> >         lags:
>>>> >           12
>>>> > r1  .02821978
>>>> >
>>>> > My new question to the list is: it is possible to just extract the r1
>>>> > values expressed in both matrix?
>>>
>>> *
>>> *   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/
>>>
>>
>>
>>
>> --
>> Rodrigo Briceño
>> Economist
>> [email protected]
>> MSN: [email protected]
>> SKYPE: rbriceno1087
>>
>> *
>> *   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/
>>
>
>
>
> --
> ---------------------------------------------------------
> João Ricardo F. de Lima
> Pesquisador A - Economia Aplicada
> Embrapa Semiárido
> e-mail: [email protected]
> fone: +55 (87) 3862-1711 Ramal: 167
> home-page: www.cpatsa.embrapa.br
> ----------------------------------------------------------
>



-- 
---------------------------------------------------------
João Ricardo F. de Lima
Pesquisador A - Economia Aplicada
Embrapa Semiárido
e-mail: [email protected]
fone: +55 (87) 3862-1711 Ramal: 167
home-page: www.cpatsa.embrapa.br
----------------------------------------------------------

*
*   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–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index