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

st: matrices from svytab with col and se options


From   Lee Sieswerda <Lee.Sieswerda@tbdhu.com>
To   "Statalist (E-mail)" <statalist@hsphsun2.harvard.edu>
Subject   st: matrices from svytab with col and se options
Date   Mon, 10 Jun 2002 18:22:42 -0400

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.

My log file it appended below.

Thanks,
Lee

Lee Sieswerda, Epidemiologist
Thunder Bay District Health Unit
999 Balmoral Street
Thunder Bay, Ontario
Canada  P7B 6E7
Tel: +1 (807) 625-5957
Fax: +1 (807) 623-2369
Lee.Sieswerda@tbdhu.com
www.tbdhu.com

----------------------------------------------------------------------------
----------------
       log:  C:\DATA\weird.log
  log type:  text
 opened on:  10 Jun 2002, 18:12:55

. svytab can12m tob12m

pweight:  weight2                               Number of obs      =
2679
Strata:   strata2                               Number of strata   =
6
PSU:      schoolid2                             Number of PSUs     =
23
                                                Population size    =
2673.6008

-------------------------------------
used      |
cannabis  | smoked cigarettes past 12
past 12   |          months          
months    | no(incl      yes    Total
----------+--------------------------
       no |   .5521    .0768    .6289
      yes |   .1595    .2116    .3711
          | 
    Total |   .7116    .2884        1
-------------------------------------
  Key:  cell proportions

  Pearson:
    Uncorrected   chi2(1)         =  611.6705
    Design-based  F(1, 17)        =  434.4571     P = 0.0000

. mat li e(b)

e(b)[1,4]
          p11        p12        p21        p22
y1  .55209713  .07676658   .1595441  .21159219

. mat li e(V)

symmetric e(V)[4,4]
            p11         p12         p21         p22
p11   .00081594
p12    .0002619   .00018399
p21  -.00090858  -.00043875   .00124971
p22  -.00016925  -7.135e-06   .00009762   .00007877

. svytab can12m tob12m, col

pweight:  weight2                               Number of obs      =
2679
Strata:   strata2                               Number of strata   =
6
PSU:      schoolid2                             Number of PSUs     =
23
                                                Population size    =
2673.6008

-------------------------------------
used      |
cannabis  | smoked cigarettes past 12
past 12   |          months          
months    | no(incl      yes    Total
----------+--------------------------
       no |   .7758    .2662    .6289
      yes |   .2242    .7338    .3711
          | 
    Total |       1        1        1
-------------------------------------
  Key:  column proportions

  Pearson:
    Uncorrected   chi2(1)         =  611.6705
    Design-based  F(1, 17)        =  434.4571     P = 0.0000

. mat li e(b)

e(b)[1,4]
          p11        p12        p21        p22
y1  .55209713  .07676658   .1595441  .21159219

. mat li e(V)

symmetric e(V)[4,4]
            p11         p12         p21         p22
p11   .00081594
p12    .0002619   .00018399
p21  -.00090858  -.00043875   .00124971
p22  -.00016925  -7.135e-06   .00009762   .00007877

. svytab can12m tob12m, col se

pweight:  weight2                               Number of obs      =
2679
Strata:   strata2                               Number of strata   =
6
PSU:      schoolid2                             Number of PSUs     =
23
                                                Population size    =
2673.6008

-------------------------------------
used      |
cannabis  | smoked cigarettes past 12
past 12   |          months          
months    | no(incl      yes    Total
----------+--------------------------
       no |   .7758    .2662    .6289
          | (.0468)  (.0359)   (.039)
          | 
      yes |   .2242    .7338    .3711
          | (.0468)  (.0359)   (.039)
          | 
    Total |       1        1        1
          |                          
-------------------------------------
  Key:  column proportions
        (standard errors of column proportions)

  Pearson:
    Uncorrected   chi2(1)         =  611.6705
    Design-based  F(1, 17)        =  434.4571     P = 0.0000

. mat li e(b)

e(b)[1,4]
          p11        p12        p21        p22
y1  .77580824  .26621899  .22419176  .73378101

. mat li e(V)

symmetric e(V)[4,4]
            p11         p12         p21         p22
p11   .00219031
p12   .00157459   .00129206
p21  -.00219031  -.00157459   .00219031
p22  -.00157459  -.00129206   .00157459   .00129206

. log close
       log:  C:\DATA\weird.log
  log type:  text
 closed on:  10 Jun 2002, 18:13:28
----------------------------------------------------------------------------
----------------

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