Statalist


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

Re: st: Extracting from returned Matrix


From   "Sergiy Radyakin" <serjradyakin@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Extracting from returned Matrix
Date   Tue, 19 Feb 2008 16:39:02 -0500

I am 100% sure that it is a classical problem of inaccessibility of
elements of e() matrix.
Together with quotes, macros and gettoken/parse this is the most
common obstacle.

Stata does not understand:
   matrix B=e(V)[2,3]

Stata does understand:
   matrix A=e(V)
   matrix B=A[2,3]

I.e. you need a temporary matrix. Think of e() as a function, and
functions do not have indices, even if the results they return are
matrices.

Best regards,
   Sergiy Radyakin


On 2/19/08, Austin Nichols <austinnichols@gmail.com> wrote:
> Martin Weiss <martin.weiss@uni-tuebingen.de>:
> You say you want to use -post- but you don't show your code, so I'm
> not sure where the problem is:
>
> webuse fuel, clear
> mean mpg*, vce(bootstrap)
> mat ci=e(ci_normal)
> postfile t row lb ub using /tmp, replace
> post t (1) (ci[1,1]) (ci[1,2])
> post t (2) (ci[2,1]) (ci[2,2])
> postutil clear
> use /tmp
> li
>
>
> On Feb 19, 2008 3:37 PM, Martin Weiss <martin.weiss@uni-tuebingen.de> wrote:
> > Guys,
> >
> > I am so sick of this: trying to extract an e()-class result stored in a
> > matrix. All I want is to show the development of the upper and lower bound
> > of the ci for the mean in
> >
> > ______________________________________
> > webuse fuel
> > mean mpg1 mpg2
> >
> > mean mpg*, vce(bootstrap, reps(100))
> >
> > mean mpg*, vce(bootstrap, reps(1000))
> > ______________________________________
> >
> >
> > I know the result is stored in "matrix list e(ci_normal)". Now how do I
> > extract the upper and lower bound (to post them to a postfile and later plot
> > the two in a tw (line ub lb) (line ub lb)-type of graph)? I can get the
> > stuff into a matrix but where do I go from there? I have been reading the
> > User`s guide up and down, but as far as I can tell, it dodges the
> > question...
> >
> *
> *   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index