[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
"Jan Brogger" <jan.brogger@med.uib.no> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: svytotal output in fixed format |

Date |
Wed, 6 Nov 2002 10:41:39 +0100 |

Many Stata commands don't leave behind confidence intervals. IMHO, this is a significant problem (e.g. it took me some time to figure out exactly how to compute the confidence intervals). However, it is easy to fix. The program below will display what you want. It will compute estimates and confidence intervals after svymean and svytotal. In the other program below this is also written to a file with an option to have a multiplier (for percentages). If you read Stata, it should be easy to understand. It gets the estimate, computes the standard error, and computes confidence intervals using the t distribution and the number of residual degrees of freedom. In tests I've run it matches all the digits that I can get from the confidence intervals printed -svymean- using maximum number of digits. When I make tables, I loop over each cell in nested for loops (e.g. 11 symtoms by 2 different genders and 4 age groups) and output each cell nicely with 95% confidence intervals to a text file. No more cut and paste of hundreds of cells for me! (I described this in an earlier post which didn't generate any commotion). This program is -not- polished (uses named scalars, cannibalizes a matrix). Jan Brogger program define dispsvymean version 7.0 foreach scal in est se lo hi {cap scalar drop `scal'} mat est=e(b) scalar est=est[1,1] mat se=e(V) scalar se=sqrt(se[1,1]) scalar lo= (est-(invttail(e(df_r),0.025)*se)) scalar hi= (est+(invttail(e(df_r),0.025)*se)) di %3.2f est " " %3.2f lo " " %3.2f hi end program define writesvymean *will write out an estimate + conf.int after svymean and svytotal version 7.0 syntax , MULtipl(real) [ fileh(string) ] if "`fileh'"=="" {local fileh "myfile" } foreach scal in est se lo hi {cap scalar drop `scal'} mat est=e(b) scalar est=est[1,1] mat se=e(V) scalar se=sqrt(se[1,1]) scalar lo= (est-(invttail(e(df_r),0.025)*se))*`multipl' scalar hi= (est+(invttail(e(df_r),0.025)*se))*`multipl' scalar est=est*`multipl' di %3.2f est " " %3.2f lo " " %3.2f hi file write `fileh' %3.2f (est) _tab /* */ %3.2f (lo) _tab /* */ %3.2f (hi) _tab end -----Original Message----- Date: Tue, 05 Nov 2002 11:07:02 -0600 From: Suzanne Graden <graden.1@osu.edu> Subject: st: svytotal output in fixed format Good day. In my analysis using svy commands (svytotal), I need estimates and confidence intervals with fixed format precision instead of the general format which results in the estimates and ci displayed in scientific notation. I have been able to display the point estimate using "matrix list e(est), format()" but I need help to obtain the upper and lower confidence limits. When I use "estimates list" the confidence limits do not seem to be stored. Is this correct or am I overlooking something? I tried to calculate the confidence limits by first using the "svmat" command to change the e(V_ds) to a variable and then formatted the variable using format(), but the result was still displayed in scientific notation. What is the best way to obtain the confidence limits displayed in fixed format when using svy commands that do not allow the user to adjust the table cell size? Suzanne Graden * * 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/

**Follow-Ups**:**st: RE: svytotal output in fixed format***From:*Roger Newson <roger.newson@kcl.ac.uk>

- Prev by Date:
**RE: st: how to extract labels** - Next by Date:
**Re: st: iv analysis with first stage probit** - Previous by thread:
**st: place to submit ado file** - Next by thread:
**st: RE: svytotal output in fixed format** - Index(es):

© Copyright 1996–2016 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |