# st: predict after svy logit

 From "Schonlau, Matthias" <[email protected]> To <[email protected]> Subject st: predict after svy logit Date Wed, 15 Jun 2005 10:42:19 -0400

```Dear stata listers:

In version 9, When I use predict after " svy: logit" the predicted probabilities range from roughly 0.8 to greater than 2.0.  I don't understand this. When predicting in Version 8.0 (under version control) I get predictions that are credible. The survey logistic regression give the same coefficients for both version 8.0 and version 9.0 , the problem is only the prediction.

Below an example with partial output. Any suggestions ?

Thanks,

Matt

---------------------------------------------------------
* these lines just generate some data
clear
set seed 1
set obs 100
gen x=uniform()
gen logit = 3 * x +uniform() -.5
gen pred = exp(logit)/ (1+ exp(logit))
gen y= uniform() < pred
gen  psum = floor((_n-1)/10)
gen stratm2 = floor((_n-1)/50)
gen patwt=uniform()+0.3

version 8.0
svyset [pweight=patwt], psu(psum) strata(stratm2)
svylogit y x
predict temp
sum temp

version 9.0
svyset  psum [pweight=patwt],  strata(stratm2)
svy : logit y x
predict temp2
sum temp2 , detail

list temp temp2

===================================
Partial : Output from example:

. svy : logit y x
(running logit on estimation sample)

Survey: Logistic regression

Number of strata   =         2                  Number of obs      =       100
Number of PSUs     =        10                  Population size    = 78.583418
Design df          =         8
F(   1,      8)    =      3.96
Prob > F           =    0.0817

------------------------------------------------------------------------------
|             Linearized
y |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
x |   1.827507   .9179305     1.99   0.082    -.2892447    3.944258
_cons |   .8259731   .6490185     1.27   0.239    -.6706663    2.322613
------------------------------------------------------------------------------

.  predict temp2
(option p assumed; Pr(y))

. sum temp2 , detail

Pr(y)
-------------------------------------------------------------
Percentiles      Smallest
1%     .8489111       .8265356
5%     .9179934       .8712866
10%     1.011611       .8794591       Obs                 100
25%     1.270084       .8906985       Sum of Wgt.         100

50%     1.845705                      Mean           1.807649
Largest       Std. Dev.      .5650812
75%     2.330985       2.634669
90%     2.535905       2.639847       Variance       .3193168
95%     2.624683       2.642325       Skewness      -.1069881
99%     2.643911       2.645498       Kurtosis       1.704952

.
. list temp temp2

+---------------------+
|     temp      temp2 |
|---------------------|
1. | .8856528   2.047086 |
2. |  .925658   2.521828 |
3. | .8470134   1.711366 |
4. | .8434895   1.684424 |
5. | .9310861   2.603494 |
|---------------------|
6. | .8632787   1.842793 |
7. | .9102473   2.316658 |
8. | .9132985   2.354591 |
9. | .8684405    1.88724 |
10. | .8197377   1.514571 |
|---------------------|
11. | .7393818   1.042758 |
12. | .8519451   1.749939 |
13. |  .865721   1.863644 |
14. | .7067101   .8794591 |
15. | .9132301   2.353728 |
|---------------------|
16. | .8504521   1.738151 |
17. | .8946925   2.139596 |
18. | .8698905   1.899991 |
19. | .7050133   .8712866 |
20. | .6956219   .8265356 |

....

Matthias Schonlau
Statistician, RAND
412-683-2300 x4917
http://www.rand.org/statistics/bios/stat_schonlau_matthias.html

--------------------

This email message is for the sole use of the intended recipient(s) and
may contain privileged information. Any unauthorized review, use,
disclosure or distribution is prohibited. If you are not the intended
of the original message.

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