Click here to run or save the do-file
.
. capture net install http://nicolaorsini.altervista.org/stata/p2ci
.
. which p2ci
c:\ado\stbplus\p\p2ci.ado
*! 1.0 N.Orsini 03 Feb 2005
.
. sysuse auto
(1978 Automobile Data)
.
. reg mpg length weight
Source | SS df MS Number of obs = 74
-------------+------------------------------ F( 2, 71) = 69.34
Model | 1616.08062 2 808.040312 Prob > F = 0.0000
Residual | 827.378835 71 11.653223 R-squared = 0.6614
-------------+------------------------------ Adj R-squared = 0.6519
Total | 2443.45946 73 33.4720474 Root MSE = 3.4137
------------------------------------------------------------------------------
mpg | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
length | -.0795935 .0553577 -1.44 0.155 -.1899736 .0307867
weight | -.0038515 .001586 -2.43 0.018 -.0070138 -.0006891
_cons | 47.88487 6.08787 7.87 0.000 35.746 60.02374
------------------------------------------------------------------------------
.
. * assuming t-distribution
.
. p2ci -.0795935 0.155 , dfr(71)
-0.080 (0.055) 95% Conf. Interval [-0.190, 0.031]
.
. * assuming z-distribution
.
. p2ci -.0795935 0.155
-0.080 (0.056) 95% Conf. Interval [-0.189, 0.030]
.
. sysuse cancer
(Patient Survival in Drug Trial)
.
. logit died studytime age
Iteration 0: log likelihood = -31.199418
Iteration 1: log likelihood = -26.82757
Iteration 2: log likelihood = -26.734502
Iteration 3: log likelihood = -26.734061
Iteration 4: log likelihood = -26.734061
Logit estimates Number of obs = 48
LR chi2(2) = 8.93
Prob > chi2 = 0.0115
Log likelihood = -26.734061 Pseudo R2 = 0.1431
------------------------------------------------------------------------------
died | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
studytime | -.0843475 .0353784 -2.38 0.017 -.153688 -.015007
age | .0518897 .0646409 0.80 0.422 -.0748042 .1785836
_cons | -.87332 3.729449 -0.23 0.815 -8.182906 6.436266
------------------------------------------------------------------------------
.
. p2ci -.0843475 0.017
-0.084 (0.035) 95% Conf. Interval [-0.154, -0.015]
.
. p2ci .0518897 0.422
0.052 (0.065) 95% Conf. Interval [-0.075, 0.179]
.
. logit died studytime , or
Iteration 0: log likelihood = -31.199418
Iteration 1: log likelihood = -27.114254
Iteration 2: log likelihood = -27.064577
Iteration 3: log likelihood = -27.064503
Logit estimates Number of obs = 48
LR chi2(1) = 8.27
Prob > chi2 = 0.0040
Log likelihood = -27.064503 Pseudo R2 = 0.1325
------------------------------------------------------------------------------
died | Odds Ratio Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
studytime | .91297 .0314266 -2.65 0.008 .8534068 .9766903
------------------------------------------------------------------------------
.
. p2ci -.0910523 0.008 , eform
0.913 (0.034) 95% Conf. Interval [0.854, 0.977]