Statalist The Stata Listserver


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

Re: st: RE: -svy: mean - problem with returned matrices


From   "Stas Kolenikov" <skolenik@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: -svy: mean - problem with returned matrices
Date   Thu, 31 May 2007 11:57:14 -0500

Some other strange occasions where I used to get errors about "no
matrices in this context" are computations of traces or
determinants... don't remember exactly, but I had to use an extra
matrix with a single element that would contain the trace of another
matrix, and the latter one could be used in scalar computations. Now
with Mata, of course, I won't bother doing any matrix manipulations in
Stata.

On 5/31/07, Nick Cox <n.j.cox@durham.ac.uk> wrote:
I think you are being bitten by code that
tests to see whether you are trying to
-display- the whole of a matrix. You
are, but it's reasonable to ask for a -display-
of the whole of a matrix which is just 1 X 1.
That's my guess. I can't see inside the code
that is behind this error report.

Nick
n.j.cox@durham.ac.uk

Steven Samuels

> Can anyone explain why I get the following error?  How can I access
> the elements of the matrix which generates the error?

> Program:
> /************************************/
> webuse nhanes2, clear
> svyset
> svy : mean height
> ereturn list
> matrix list e(V_srs)
> di el(e(V_srs),1,1)   //OKAY
>
> matrix list e(b)
> di el(e(b),1,1)      //GENERATES ERROR
> /*************************************/
>
> Log:
> webuse nhanes2, clear
>
> . svyset
>
>        pweight: finalwgt
>            VCE: linearized
>       Strata 1: strata
>           SU 1: psu
>          FPC 1: <zero>
>
> . svy : mean height
> (running mean on estimation sample)
>
> Survey: Mean estimation
>
> Number of strata =      31          Number of obs    =   10351
> Number of PSUs   =      62          Population size  = 1.2e+08
>                                      Design df        =      31
> --------------------------------------------------------------
>               |             Linearized
>               |       Mean   Std. Err.     [95% Conf. Interval]
> -------------+------------------------------------------------
>        height |   168.4599   .1466103      168.1609    168.7589
> --------------------------------------------------------------
>
> . ereturn list
>
> scalars: [OUTPUT SKIPPED]
> macros:  [OUTPUT SKIPPED]
>
> matrices:
>                   e(b) :  1 x 1
>                   e(V) :  1 x 1
>             e(_N_subp) :  1 x 1
>               e(V_srs) :  1 x 1
>                  e(_N) :  1 x 1
>               e(error) :  1 x 1
>
> functions: [OUTPUT SKIPPED]
>
> . matrix list e(V_srs)
>
> symmetric e(V_srs)[1,1]
>             height
> height  .00908828
>
> . di el(e(V_srs),1,1)   //OKAY
> .00908828
>
> . matrix list e(b)
>
> symmetric e(b)[1,1]
>         height
> y1  168.45989
>
> . di el(e(b),1,1)   //GENERATES ERROR
> matrix operators that return matrices not allowed in this context
> r(509);

*
*   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/


--
Stas Kolenikov
http://stas.kolenikov.name
*
*   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