Stata Technical Bulletin
STB-33
For the variable black:
. regpred2 chi age, adj(race) from(40) to(SO) one(raceb) zero(racew)
And for the variable asian:
. regpred2 chi age, adj(race) from(40) to(80) zero(racew raceb)
regpred2 will not permit the user to specify the same variable to be set to both one and zero. The attempt to do so will
generate an “error 198”.
Examples of the level() and inst() options
Another change introduced in regpred2 is to allow the confidence intervals displayed in the graphs and presented in the
predictions to differ from 95%. regpred2 implements the standard Stata convention of defaulting to a confidence level set by
the S-Ievel macro. The S-Ievel macro can be overridden by including among the regpred2 options, the option level(#),
where # is the desired confidence interval expressed as a percentage.
Here are examples of the application of the lev el(#) and the in st iivlist') options. The data used is that in Garrett’s insert
in STB-26. First, apply regpred2 as regpred could have been applied, only adding the level(#) option to demonstrate how it
works. Here is the output, including the predicted values and 90% intervals in Figure 1.
. regpred2 chi sbp, f(60) t(300) i(20) adj(age smk) level(90) xlabel ylabel
Source I |
SS |
df MS |
Number of obs F( 3, 1214) |
= 1218 = 0.37 | |
_________-|-_ |
— | ||||
Model I |
1771.65999 |
3 590.55333 |
Prob > F |
= 0.7732 | |
Residual ∣ |
1927027.32 |
1214 1587.33716 |
R-Squared Adj R-Squared |
= 0.0009 = -0.0016 | |
---------+_ |
— | ||||
Total I |
1928798.98 |
1217 1584.88001 |
Root MSE |
= 39.841 | |
— chi I |
Coef. |
Std. Err. t |
p>∣t∣ |
[907. Conf. |
— Interval] |
— | |||||
sbp I |
.0404827 |
.0438582 0.923 |
0.356 |
-.0317128 |
.1126782 |
age I |
-.0632856 |
.131533 -0.481 |
0.631 |
-.2798034 |
.1532323 |
smk I |
-1.328942 |
2.399776 -0.554 |
0.580 |
-5.279237 |
2.621353 |
-Cons I |
210.093 |
8.212943 25.581 |
0.000 |
196.5736 |
223.6124 |
Predicted Values and 90% Confidence Intervals
Outcome Variable: Serum cholesterol — chi
Independent Variable: Systolic blood pressure — sbp
Covariates: age smk
Instruments :
Variables set to Zero:
Variables set to One:
Total Observations: 1218
Confidence interval: 90
sbp |
pred_y |
lower |
upper | |
1. |
60 |
208.2786 |
201.8328 |
214.7245 |
2. |
80 |
209.0883 |
204.0052 |
214.1713 |
3. |
100 |
209.8979 |
206.1179 |
213.678 |
4. |
120 |
210.7076 |
208.0801 |
213.3351 |
5. |
140 |
211.5172 |
209.5984 |
213.4361 |
6. |
160 |
212.3269 |
210.1766 |
214.4772 |
7. |
180 |
213.1365 |
210.0174 |
216.2556 |
8. |
200 |
213.9462 |
209.5876 |
218.3048 |
9. |
220 |
214.7558 |
209.0612 |
220.4505 |
10. |
240 |
215.5655 |
208.4927 |
222.6383 |
11. |
260 |
216.3752 |
207.9027 |
224.8476 |
12. |
280 |
217.1848 |
207.3002 |
227.0694 |
13. |
300 |
217.9945 |
206.69 |
229.2989 |