Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Export Confidence Intervals with Putexcel

    Hi,

    I would like to export confidence intervals for means to excel.
    For exporting the mean of xxx I use that code:

    svy: tab xxx
    matrix results = e(b)*100
    matrix rslts = results[1...,2..2]
    putexcel A1 = matrix(rslts), nformat("0.00")

    Is there a possibility to export the confidence intervals as well?

    Thanks for your help!

  • #2
    Use svy: proportion instead.

    Code:
    webuse nhanes2b, clear
    svyset psuid [pweight=finalwgt], strata(stratid)
    svy: tab race, ci
    svy: proportion race
    mat l r(table)
    Res.:

    Code:
    . svy: tab race, ci
    (running tabulate on estimation sample)
    
    Number of strata   =        31                Number of obs     =       10,351
    Number of PSUs     =        62                Population size   =  117,157,513
                                                  Design df         =           31
    
    ----------------------------------------------
    1=white,  |
    2=black,  |
    3=other   | proportion          lb          ub
    ----------+-----------------------------------
        White |      .8792       .8408       .9093
        Black |      .0955       .0725       .1249
        Other |      .0253       .0108       .0585
              | 
        Total |          1                        
    ----------------------------------------------
      Key:  proportion  =  cell proportion
            lb          =  lower 95% confidence bound for cell proportion
            ub          =  upper 95% confidence bound for cell proportion
    
    . 
    . svy: proportion race
    (running proportion on estimation sample)
    
    Survey: Proportion estimation
    
    Number of strata =      31      Number of obs   =       10,351
    Number of PSUs   =      62      Population size =  117,157,513
                                    Design df       =           31
    
    --------------------------------------------------------------
                 |             Linearized            Logit
                 | Proportion   Std. Err.     [95% Conf. Interval]
    -------------+------------------------------------------------
            race |
          White  |   .8791545    .016689      .8407837    .9092758
          Black  |   .0955059   .0127491      .0724809    .1248606
          Other  |   .0253396   .0105423      .0107686    .0584618
    --------------------------------------------------------------
    
    . 
    . mat l r(table)
    
    r(table)[9,3]
                    1.         2.         3.
                 race       race       race
         b  .87915445  .09550592  .02533963
        se  .01668898   .0127491  .01054229
         t  52.678735  7.4911907  2.4036177
    pvalue  6.693e-32  1.931e-08   .0224027
        ll  .84078371  .07248092  .01076856
        ul  .90927575  .12486062  .05846181
        df         31         31         31
      crit  2.0395134  2.0395134  2.0395134
     eform          0          0          0
    
    .

    Comment

    Working...
    X