Announcement

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

  • Access 95%CI after using svy: mean variables, over(group)

    Hi,

    I'm working with a dataset that uses some fancy survey sampling design, which I think I've finally understood. After using the svy-commands, and so on, I want to find the means and 95% CI of the variable by age. The command finds the mean, standard error, and 95% CI, but I have no idea how to access the confidence interval, even after a lot of googling!


    Please the below MWE, where a dataset is included at the end.

    Code:
    svyset cluster [pweight= wgt], strata(stratum)
    svy: mean giver
    Note that the svy: mean giver command gives me the mean, standard error and the 95% CI. I also want to store the 95% CI in a local/scalar whatever. What is the name of the matrix that the CI is stored in?
    Code:
    scalar mean = e(b)[1,1] //works
    di mean
    scalar CI_lowerbound = e(ci)[1,1] // does not work, in what matrix are the lower and upper bounds of the ci stored?
    Where are the 95% CI stored?

    Code:
    * Example generated by -dataex-. To install: ssc install dataex
    clear
    input float wgt byte(stratum cluster) float giver
    26.538713 1 2 0
    .14287305 2 1 0
    13.541413 2 1 0
    1.5445018 1 2 0
    1.2428784 1 3 0
    .14605893 1 3 0
      41.5022 1 2 0
    1.3487246 1 2 0
    1.3300264 1 3 0
    2.2500246 2 2 1
     10.70082 2 2 0
     26.03309 1 3 0
    2.2902308 1 3 0
    1.3894604 1 2 0
    end

    [/CODE]


  • #2
    See the matrix -r(table)- in

    Code:
    return list
    You want

    Code:
    di r(table)[rownumb(r(table), "ll"),1 ]
    di r(table)[rownumb(r(table), "ul"),1 ]

    Comment


    • #3
      Thank you!

      Comment

      Working...
      X