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: Re: Antwort: Re: st: RE: matrix results saved
From
Rodrigo Briceño <[email protected]>
To
[email protected]
Subject
Re: Re: Antwort: Re: st: RE: matrix results saved
Date
Thu, 11 Nov 2010 11:10:53 -0600
Thanks to Richard, Nick and Joao. You provided me the knowledge I required.
I will post my full syntax so anyone in the future with a similar
problem would be able to see the answer easily:
regress liq sap liqmk pprom if isin2==3
estat imtest, white
local hettest = r(chi2)
local hetprob = r(p)
estadd scalar hettest = `hettest'
estadd scalar hetp = `hetprob'
estat bgodfrey, lags(12)
matrix bgchi2s = r(chi2)
matrix bgchi2p = r(p)
estadd scalar bgchi2s = bgchi2s[1,1]
estadd scalar bgchi2p = bgchi2p[1,1]
estimates store m1, title(CRALDSFH0021)
estout, cells(b(star fmt(%9.3f)) se(par)) stats(r2_a N hettest hetp
bgchi2s bgchi2p, fmt(%9.3f %9.0g %9.3f %9.3f %9.3f %9.3f)
labels(R-squared)) legend label collabels(none) varlabels(_cons
Constant)
2010/11/11 Richard Ochmann <[email protected]>:
> ...
> well, then you need to save the returned matrices first and put the
> elements of interest into scalars afterwards.
>
> ***
> matrix chi2s = r(chi2)
> matrix chi2p = r(p)
> scalar chi2s = chi2s[1,1]
> scalar chi2p = chi2p[1,1]
> ***
>
> best, rich
>
> [email protected] schrieb am 11.11.2010 17:21:29:
>
>> 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/
>
>
> *
> * 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/