Dear Austin and other lister,
I used the code from [email protected], which you let me know in your e-mail the other day. I believe I didn't make any typographical error, but STATA didn't calculate CIs and ended up with a caution message ( invalid name r(199);.
Below is the outputs:
**** START
2. svyprop cat1Rr cat2Rr cat3Rr
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 |
+---------------------------------------------------------+
3 . di "cat1Rr cat2Rr cat3Rr (Lower Bound, Upper Bound)"
cat1Rr cat2Rr cat3Rr (Lower Bound, Upper Bound)
4 . forvalues i=0/2 {
2. forvalues j=0/2 {
3. forvalues k=0/2 {
4. qui gen i`i'j`j'k`k'=(cat1Rr==`i' & cat2Rr==`j' & cat3Rr==`k')
5. qui su i`i'j`j'k`k'
6. if r(max)>0 & r(N)>0 {
7. qui svylogit i`i'j`j'k`k'
8. scalar lcb = invlogit(_b[_cons]-invttail(e(df_r),.025)*_se [_cons])
9. scalar ucb = invlogit(_b[_cons]+invttail(e(df_r),.025)*_se[_cons])
10. di " `i' `j' `k' ( " scalar(lcb) " , "
11. scalar(ucb) " )"
12. }
13. }
14. }
15. }
0 0 0 ( .00203944 ,
( invalid name
r(199);
*** END
Did I make any mistake? Any suggestion? Many thanks for your invaluable help to a novice STATA user. Hong
----- Original Message -----
From: "Nichols, Austin" <[email protected]>
Date: Wednesday, September 1, 2004 6:16 pm
Subject: RE: st: calculrating confidence Intervals in svyprop statements
> Note that you report nine categories, and I don't think your CIs
> will be
> plausible, given the number of obs and apparent weighting and
> survey design.
> Plus your categories are suspect, since if they were 0/2 you would
> have 27
> categories instead of nine. But mine is not to reason why. Using
> code from
> [email protected],
>
> di "cat1Rr cat2Rr cat3Rr (Lower Bound, Upper Bound)"
> forvalues i=0/2 {
> forvalues j=0/2 {
> forvalues k=0/2 {
> qui gen i`i'j`j'k`k'=(cat1Rr==`i' & cat2Rr==`j' & cat3Rr==`k')
> qui su i`i'j`j'k`k'
> if r(max)>0 & r(N)>0 {
> qui svylogit i`i'j`j'k`k'
> 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 "
> `i' `j' `k' ( " scalar(lcb) " , "
> scalar(ucb) " )"
> }
> }
> }
> }
>
> gives CIs that are constructed independently and cannot be used to
> eyeball-test joint hypotheses about proportions. Caveat emptor.
>
> -----Original Message-----
> From: [email protected] [[email protected]]
> Sent: Wednesday, September 01, 2004 5:35 PM
> To: [email protected]
> Subject: Re: st: calculrating confidence Intervals in svyprop
> statements
> 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.
>
> *
> * 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/