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

st: RE: using replace command and retrieving conf. intervals


From   "Steichen, Thomas" <[email protected]>
To   <[email protected]>
Subject   st: RE: using replace command and retrieving conf. intervals
Date   Tue, 23 Jul 2002 15:53:06 -0400

The easiest fix for your problem is to use -float()- to ensure
the same precision on both sides of your -if- comparison, for example:

  . replace interval = 3.674772  if float(se) == float(.5773503)

Tom

> -----Original Message-----
> From: [email protected] [mailto:[email protected]] 
> Sent: Tuesday, July 23, 2002 3:30 PM
> To: [email protected]
> Subject: st: using replace command and retrieving conf. intervals
> 
> 
> while trying to figure out how the  confidence interval at 
> 95% level is linked 
> to the standard error, I came up with following problem (as I 
> tried to use the 
> replace command) : the parts of the command that connect are 
> just for standard 
> errors 0, .25, .5 and .75 .Obviously the standard errors 
> visible on the screen 
> are not perfectly consistent with what is visible plus the 
> hidden parts 
> (lingering parts) .Can anyone help me with that.And while I 
> am at it ,can 
> anyone tell me how to retrieve the lower boundaries  and the 
> upper boundaries 
> of confidence intervals  ?
> 
>     
> .        capture program drop lnsimvz1
> 
> . 
> .         program define lnsimvz1
>   1.                 if "`1'"=="?" {
>   2.                         global S_1 " pu pl p se t mean"
>   3.                         exit
>   4.                 }
>   5.                 drop _all
>   6.                 use clt
>   7.                 sample 4
>   8.                ttest a = 3
>   9.               return list
>  10.           post `1'  r(p_u) r(p_l) r(p) r(se) r(t) r(mu_1) 
>  11.         end
> 
> . 
> . 
> end of do-file
> 
> . simul  lnsimvz1 , reps(1000)
> 
> . list in 1/5
> 
>             pu         pl          p         se          t       mean 
>   1.   .681191    .318809   .6376181   .4787135  -.5222329    
>    2.75  
>   2.  .7524873   .2475127   .4950253   .6454972  -.7745967    
>     2.5  
>   3.         .          .          .          0          .    
>       4  
>   4.  .7524873   .2475127   .4950253   .6454972  -.7745967    
>     2.5  
>   5.        .5         .5          1   .7071068          0    
>       3  
> 
> . tab se
> 
>          se |      Freq.     Percent        Cum.
> ------------+-----------------------------------
>           0 |         34        3.40        3.40
>         .25 |        134       13.40       16.80
>    .2886751 |        108       10.80       27.60
>    .4082483 |        117       11.70       39.30
>    .4787135 |        232       23.20       62.50
>          .5 |         67        6.70       69.20
>    .5773503 |         52        5.20       74.40
>    .6291529 |         62        6.20       80.60
>    .6454972 |         49        4.90       85.50
>    .7071068 |         57        5.70       91.20
>         .75 |         80        8.00       99.20
>    .8660254 |          8        0.80      100.00
> ------------+-----------------------------------
>       Total |       1000      100.00
> 
> . do "C:\WINDOWS\TEMP\STD010000.tmp"
> 
> . gen interval = 1.837386 
> 
> . replace interval  = 0 if se == 0
> (34 real changes made)
> 
> . replace interval = 1.591224 if se == .25
> (134 real changes made)
> 
> . replace interval = 1.591224  if se == .2886751
> (0 real changes made)
> 
> . replace interval = 2.598456 if se == .4082483
> (0 real changes made)
> 
> . replace interval = 3.04696 if se == .4787135
> (0 real changes made)
> 
> . replace interval =3.182446 if se == .5
> (67 real changes made)
> 
> . replace interval = 3.674772  if se == .5773503
> (0 real changes made)
> 
> . replace interval = 4.0044902 if se == .6291529
> (0 real changes made)
> 
> . replace interval = 4.1085203 if se == .6454972
> (0 real changes made)
> 
> . replace interval =4.5006584 if se == .7071068
> (0 real changes made)
> 
> . replace interval = 4.7736697 if se == .75
> (80 real changes made)
> 
> . replace interval = 5.5121583 if se == .8660254
> (0 real changes made)
> 
> . 
> . 
> end of do-file
> 
> . 
> *
> *   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/
> 
CONFIDENTIALITY NOTE:  This e-mail message, including any attachment(s), contains information that may be confidential, protected by the attorney-client or other legal privileges, and/or proprietary non-public information.  If you are not an intended recipient of this message or an authorized assistant to an intended recipient, please notify the sender by replying to this message and then delete it from your system.  Use, dissemination, distribution, or reproduction of this message and/or any of its attachments (if any) by unintended recipients is not authorized and may be unlawful.




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