Statalist


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

st: Confidence Interval for Proportion


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: Confidence Interval for Proportion
Date   Tue, 11 Mar 2008 14:24:42 +0100

Dear Statalisters,

try this in Stata:


************************
sysuse auto, clear
proportion rep78
matrix define A=e(b)
matrix define B=e(V)
count if rep78!=.
*Upper/Lower Bound for proportion of "1"
di A[1,1]+invnormal(1-0.05/2)*sqrt(A[1,1]*(1-A[1,1])/`r(N)')
di A[1,1]-invnormal(1-0.05/2)*sqrt(A[1,1]*(1-A[1,1])/`r(N)')
*Standard Error for "1"
*Mistake obviously there...
di sqrt(A[1,1]*(1-A[1,1])/`r(N)')
************************


Then let me know: why do I not hit the correct CI for the proportion of "1"
in the repair record? Something`s wrong with the standard error, I do not
know what, though...



Martin Weiss



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