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

Re: st: calculrating confidence Intervals in svyprop statements


From   <[email protected]>
To   [email protected]
Subject   Re: st: calculrating confidence Intervals in svyprop statements
Date   Wed, 01 Sep 2004 17:35:06 -0400

Hi Jeff and other Stata lister,


Despite of some valuable comments of you, I couldn't solve the problem. At the last reply, Jeff explained about how to get CI with "SVYMEAN" statements. I need to calculate CIs with "SVYPROP" statements, however. Below is the table explaining how I calculate 8 Est. Prop. 



**** BEGIN:
svyprop  cat1Rr cat2Rr  cat3Rr
      
pweight:  wtdper98                 Number of obs      =       364
Strata:   <one>                    Number of strata   =         1
PSU:      <observations>           Number of PSUs     =       364
                                   Population size    = 3657115.5

      
      Survey proportions estimation
      
        +---------------------------------------------------------+
        | cat1Rr   cat2Rr   cat3Rr   Obs   Est. Prop.   Std. Err. |
        |---------------------------------------------------------|
        |      0        0        0    65     0.202852    0.026513 |
        |      0        0        1    29     0.078938    0.020018 |
        |      0        1        0    13     0.028383    0.009759 |
        |      0        1        1     2     0.003007    0.002141 |
        |      1        0        0     5     0.005753    0.003897 |
        |---------------------------------------------------------|
        |      1        0        1     1     0.003676    0.003676 |
        |      1        1        0     2     0.002165    0.001566 |
        |      1        1        1     1     0.002011    0.002014 |
        |      2        2        2   246     0.673215    0.031302 |
        +---------------------------------------------------------+
*** END:



My questions are:

1) To get CIs for the 8 Est. Prop. separately, I first need to create a new variable with 8 categories? If so, how? 

2) And then, how can I calculate CI of Est. Prop in this case?

Sorry for the repeated question and many thanks for your time and generous help in advance.

Hong








----- Original Message -----
From: [email protected] (Jeff Pitblado, StataCorp LP)
Date: Friday, August 27, 2004 11:01 am
Subject: Re: st: calculrating confidence Intervals in svyprop statements

> Hong <[email protected]> asks about producing confidence intervals for
> categories of some category variables:
> 
> > By following Stas' suggestion, I checked the common_options and 
> tried it.
> > Unfortunately, svyprop doesn't allow "ci " as a common_option. 
> Below is the
> > caution message popped up on the STATA Results window.
> > 
> > svyprop  cat1Rr cat2Rr cat3Rr,  ci
> > option ci not allowed
> > r(198);
> > 
> > Is there anyone who has any other suggestion? Thanks for 
> considering of it.
> > FYI, the all three combined variables -cat1Rr, catRr, and cat3Rr-
> are binary
> > variables(0,1).
> 
> You can get normal based confidence intervals already by using -
> svymean-.
> Here is a simple example:
> 
> 	. sysuse auto, clear
> 	. svyset, srs
> 	. svymean foreign
> 
> Here are the results from -svymean- above:
> 
> ***** BEGIN:
> Survey mean estimation
> 
> pweight:  <none>                                  Number of obs    
> =        74
> Strata:   <one>                                   Number of strata 
> =         1
> PSU:      <observations>                          Number of PSUs   
> =        74
>                                                  Population size  
> =        74
> 
> -------------------------------------------------------------------
> -----------
>    Mean |   Estimate    Std. Err.   [95% Conf. Interval]        Deff
> ---------+---------------------------------------------------------
> -----------
> foreign |   .2972973    .0534958    .1906803    .4039143          
> 1
> -------------------------------------------------------------------
> -----------
> ***** END:
> 
> -foreign- is an indicator variable for foreign made cars.  
> However, if you
> wanted a point and interval estimate for each category, first 
> generate an
> indicator variable for each using -tabulate, generate()-:
> 
> 	. sysuse auto, clear
> 	. svyset, srs
> 	. tabulate rep78, generate(repcat)
> 	. svymean repcat*
> 
> Here are the results from -svymean- above:
> 
> ***** BEGIN:
> . svymean repcat*
> 
> Survey mean estimation
> 
> pweight:  <none>                                  Number of obs(*) 
> =        74
> Strata:   <one>                                   Number of strata 
> =         1
> PSU:      <observations>                          Number of PSUs   
> =        74
>                                                  Population size  
> =        74
> 
> -------------------------------------------------------------------
> -----------
>    Mean |   Estimate    Std. Err.   [95% Conf. Interval]        Deff
> ---------+---------------------------------------------------------
> -----------
> repcat1 |   .0289855    .0203446   -.0116115    .0695825          
> 1
> repcat2 |    .115942    .0388245    .0384689    .1934152          
> 1
> repcat3 |   .4347826    .0601159    .3148232     .554742          
> 1
> repcat4 |   .2608696    .0532498    .1546113    .3671278          
> 1
> repcat5 |   .1594203    .0443922     .070837    .2480036          
> 1
> -------------------------------------------------------------------
> -----------
> (*) Some variables contain missing values.
> ***** END:
> 
> Note that you need to look at the label of the newly generated 
> variable to
> determine which category the new variable -tabulate- generated 
> belongs to.  In
> the above case the assignment is pretty straight forward: repcat1 
> identifiesrep78 == 1, ..., and repcat5 identifies rep78==5.
> 
> The Ci for -repcat1- is not entirely contained in [0,1].  In a 
> previous email
> to Statalist, "Nichols, Austin" <[email protected]> indicated 
> using the
> inverse logit transform of the confidence interval limits from -
> svylogit-.
> Here is an example of how this can be done:
> 
> 	. sysuse auto, clear
> 	. svyset, srs
> 	. tabulate rep78, generate(repcat)
> 	. svylogit repcat1
> 	. scalar lcb = invlogit(_b[_cons]-invttail(e(df_r),.025)*_se[_cons])
> 	. scalar ucb = invlogit(_b[_cons]+invttail(e(df_r),.025)*_se[_cons])
> 	. di "CI for repcat1 is (" scalar(lcb) ", " scalar(ucb) ")"
> 
> Here are the results from above:
> 
> ***** BEGIN:
> . svylogit repcat1
> 
> Survey logistic regression
> 
> pweight:  <none>                                  Number of obs    
> =        69
> Strata:   <one>                                   Number of strata 
> =         1
> PSU:      <observations>                          Number of PSUs   
> =        69
>                                                  Population size  
> =        69
>                                                  F(   0,     69)  
> =         .
>                                                  Prob > F         
> =         .
> 
> -------------------------------------------------------------------
> -----------
>     repcat1 |      Coef.   Std. Err.      t    P>|t|     [95% 
> Conf. Interval]
> -------------+-----------------------------------------------------
> -----------
>       _cons |  -3.511545   .7228401    -4.86   0.000     -4.95395 
>  -2.069141
> -------------------------------------------------------------------
> -----------
> 
> . scalar lcb = invlogit(_b[_cons]-invttail(e(df_r),.025)*_se[_cons])
> 
> . scalar ucb = invlogit(_b[_cons]+invttail(e(df_r),.025)*_se[_cons])
> 
> . di "CI for repcat1 is (" scalar(lcb) ", " scalar(ucb) ")"
> CI for repcat1 is (.00700605, .11213258)
> ***** 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/
> 

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