Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: matrices from svytab with col and se options


From   [email protected] (Jeff Pitblado, Stata Corp.)
To   [email protected]
Subject   Re: st: matrices from svytab with col and se options
Date   Tue, 11 Jun 2002 09:45:20 -0500

Lee Sieswerda <[email protected]> asks about the contents of -e(b)- and
-e(V)- after -svytab-:

> Its late in the day, so maybe I'm just tired, but -svytab- appears to be
> acting strangely. If you run -svytab- with no options, a table is printed
> with the cell proportions, and a corresponding vector e(b) is saved. If you
> run -svytab- with the -col- option it prints the column proportions, but
> e(b) still contains the regular cell proportions. This may not seem
> exceedingly strange since it is easy enough to derive the column proportions
> from the cell proportions for display purposes. However, if, in addition to
> the -col- option, you also specify the -se- option (which prints the
> standard errors in the table beneath the proportion estimates), then e(b)
> contains the column proportions not the cell proportions. Is it just me, or
> is that a little counter-intuitive? Wouldn't it be better to always return
> the column proportions in e(b) when the -col- option is specified rather
> than making it dependent on also specifying the -se- option?  Also,
> everything that I just said about the estimate vector e(b) applies equally
> to the variance matrix e(V), which is even more sinister because its harder
> to spot an error in the variance than in the estimate itself.

-svytab- saves in e(setype) the type of variance (thus standard errors) that
it returns in e(V).  The default is -cell- proportions, unless you use the
-se- option.

If you want to work with the variances from the -column- proportions, then use
the -column- and -se- options.  Note that -e(V)- is the (co)-variance matrix
of -e(b)-, thus if you are asking for the -column- proportion variances to be
returned in -e(V)-, you are also asking for the -column- proportions
themselves to be placed in -e(b)-.

It is the variance (SE) calculations that specify what is put in -e(b)- and
-e(V)- for -svytab-.

***** BEGIN
. use auto

. svytab for rep

pweight:  <none>                                Number of obs      =        69
Strata:   <one>                                 Number of strata   =         1
PSU:      <observations>                        Number of PSUs     =        69
                                                Population size    =        69

----------------------------------------------------
          |            Repair Record 1978           
 Car type |     1      2      3      4      5  Total
----------+-----------------------------------------
 Domestic |  .029  .1159  .3913  .1304   .029  .6957
  Foreign |     0      0  .0435  .1304  .1304  .3043
          | 
    Total |  .029  .1159  .4348  .2609  .1594      1
----------------------------------------------------
  Key:  cell proportions

  Pearson:
    Uncorrected   chi2(4)         =   27.2640
    Design-based  F(4.00, 271.76) =    6.8334     P = 0.0000

. di e(setype)
cell

. mat li e(b)

e(b)[1,10]
          p11        p12        p13        p14        p15        p21
y1  .02898551  .11594203  .39130435  .13043478  .02898551          0

          p22        p23        p24        p25
y1          0  .04347826  .13043478  .13043478

. svytab for rep, col

pweight:  <none>                                Number of obs      =        69
Strata:   <one>                                 Number of strata   =         1
PSU:      <observations>                        Number of PSUs     =        69
                                                Population size    =        69

----------------------------------------------------
          |            Repair Record 1978           
 Car type |     1      2      3      4      5  Total
----------+-----------------------------------------
 Domestic |     1      1     .9     .5  .1818  .6957
  Foreign |     0      0     .1     .5  .8182  .3043
          | 
    Total |     1      1      1      1      1      1
----------------------------------------------------
  Key:  column proportions

  Pearson:
    Uncorrected   chi2(4)         =   27.2640
    Design-based  F(4.00, 271.76) =    6.8334     P = 0.0000

. di e(setype)
cell

. mat li e(b)

e(b)[1,10]
          p11        p12        p13        p14        p15        p21
y1  .02898551  .11594203  .39130435  .13043478  .02898551          0

          p22        p23        p24        p25
y1          0  .04347826  .13043478  .13043478

. svytab for rep, col se

pweight:  <none>                                Number of obs      =        69
Strata:   <one>                                 Number of strata   =         1
PSU:      <observations>                        Number of PSUs     =        69
                                                Population size    =        69

----------------------------------------------------------------
          |                  Repair Record 1978                 
 Car type |       1        2        3        4        5    Total
----------+-----------------------------------------------------
 Domestic |       1        1       .9       .5    .1818    .6957
          |     (0)      (0)  (.0552)  (.1187)  (.1171)  (.0558)
          | 
  Foreign |       0        0       .1       .5    .8182    .3043
          |     (0)      (0)  (.0552)  (.1187)  (.1171)  (.0558)
          | 
    Total |       1        1        1        1        1        1
          |                                                     
----------------------------------------------------------------
  Key:  column proportions
        (standard errors of column proportions)

  Pearson:
    Uncorrected   chi2(4)         =   27.2640
    Design-based  F(4.00, 271.76) =    6.8334     P = 0.0000

. di e(setype)
column

. mat li e(b)

e(b)[1,10]
          p11        p12        p13        p14        p15        p21
y1          1          1         .9         .5  .18181818          0

          p22        p23        p24        p25
y1          0         .1         .5  .81818182

. qui log close

***** END

--Jeff
[email protected]
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index