Search
   >> Home >> Resources & support >> FAQs >> Predicted probabilities after svylogit, svyprobt, svymlog, svyolog, or svyoprob
Note: This FAQ is for users of Stata 5, an older version of Stata. It is not relevant for more recent versions.

Stata 5: How can I get predicted probabilities after svylogit, svyprobt, svymlog, svyolog, or svyoprob?

Title   Stata 5: Predicted probabilities after svylogit, svyprobt, svymlog, svyolog, or svyoprob
Author William Sribney, StataCorp
Date June 1998

The predict command does work after these svy commands; however, it does NOT give predicted probabilities. After the svy estimation commands, predict just computes the index X*b. (This is because the svy commands are implemented as ado-files, and predict is just performing according to its default behavior.)

Note: The svymlog, svyolog, and svyoprob commands are not shipped with Stata 5.0, but they are available from the current ado-file updates.

svylogit, svyprobt, and svymlog

The easiest way to get predicted probabilities for svylogit, svyprobt, or svymlog is to estimate the model again using the analogous non-svy command (i.e., logit, probit, mlogit, ologit, or oprobit) with aweights and then use predict to get predicted probabilities.

Example:

Suppose that you estimated

    . svylogit y x1 x2 x3 [pw=weight], strata(county) psu(block)
    

To get predict probabilities, run

    . logit y x1 x2 x3 [aw=weight] if county~=. & block~=.
    . predict prob
    

Note that if there are missing values of the strata and/or psu identifiers, it is important to omit them from the logit estimation so that the estimation sample is the same.

As a check, you should confirm that you get the same number of observations and exactly the same point estimates from the non-svy estimation as from the svy estimation.

Should you wish to use predict after svymlog to compute X*b, see the note at the end of this file.

svyolog and svyoprob

If you want predicted probabilities after svyolog and svyoprob, you can use the ologitp and oprobitp commands immediately afterwards. There is no need to use ologit or oprobit.

Example:

   . svyolog y x1 x2 x3
   . ologitp p1 p2 p3 p4
   

Note that you must have the updated versions of ologitp and oprobitp for them to work after the svy commands. You will have the updated versions if you installed the current ado-file updates (or any update from January 1998 or later).

Note about using predict after svymlog

If you do use predict after svymlog to compute the indexes X*b_i for the various outcomes, note that predict is more limited in its syntax after svymlog than after mlogit.

If your outcome variable has value labels, then, after mlogit, you can use any of the following syntaxes:

    . predict p1, outcome(#1)
    . predict p1, outcome(low)
    . predict p1, outcome(1)
   

The first syntax refers to equation #1. The second refers to the label of the outcome corresponding to the equation. The third refers to the value of the outcome.

After svymlog, only the first and second syntaxes can be used if you have value labels for the outcome variable. If the outcome variable does not have value labels, only the first and third syntaxes can be used.

Also note that predict after svymlog CANNOT be used to compute the index X*b for the base category (i.e., the outcome omitted from the output table).

predict is much smarter after mlogit than after svymlog because predict has special code to handle mlogit. Since svymlog is a new ado-file command, predict just works according to its default behavior. This will be changed in the next release of Stata.

Example:

 . svymlog y x [pw=weight]
    
 Survey multinomial logistic regression
 
 pweight:  weight                                  Number of obs    =       138
 Strata:   county                                  Number of strata =         4
 PSU:      block                                   Number of PSUs   =        31
                                                   Population size  =    418420
                                                   F(   2,     26)  =      5.88
                                                   Prob > F         =    0.0078
 
 ------------------------------------------------------------------------------
        y |      Coef.    Std. Err.       t     P>|t|      [95% Conf. Interval]
 ---------+--------------------------------------------------------------------
 med      |
        x |   .0693467    .0411836      1.684   0.104      -.015155    .1538484
    _cons |  -1.999809    .8354973     -2.394   0.024     -3.714108   -.2855103
 ---------+--------------------------------------------------------------------
 high     |
        x |   .1245421    .0360991      3.450   0.002      .0504728    .1986114
    _cons |  -3.043893    .7973102     -3.818   0.001     -4.679838   -1.407947
 ------------------------------------------------------------------------------
 (Outcome y==low is the comparison group)
         
 . predict xb1, outcome(low)      [cannot predict base category]
 equation low not found
 r(303);
 
 . predict xb2, outcome(2)        [does not understand VALUES]
 equation 2 not found
 r(303);
 
 . predict xb2, outcome(med)      [this works; it understands LABELS]
 
 . drop xb2
 
 . predict xb2, outcome(#2)       [this works; it understands equation #]
 
 . mlogit y x [aw=weight]
 
 (sum of wgt is  4.1842e+005)
 Iteration 0:  Log Likelihood = -145.7142
 Iteration 1:  Log Likelihood =-140.68303
 Iteration 2:  Log Likelihood =-140.59693
 Iteration 3:  Log Likelihood =-140.59682
 
 Multinomial regression                                  Number of obs =    137
                                                         chi2(2)       =  10.23
                                                         Prob > chi2   = 0.0060
 Log Likelihood = -140.59682                             Pseudo R2     = 0.0351
 
 ------------------------------------------------------------------------------
        y |      Coef.   Std. Err.       z     P>|z|       [95% Conf. Interval]
 ---------+--------------------------------------------------------------------
 med      |
        x |   .0693467   .0437481      1.585   0.113      -.0163981    .1550915
    _cons |  -1.999809   .8845866     -2.261   0.024      -3.733567   -.2660512
 ---------+--------------------------------------------------------------------
 high     |
        x |   .1245421    .041514      3.000   0.003       .0431762     .205908
    _cons |  -3.043893   .8684863     -3.505   0.000      -4.746095   -1.341691
 ------------------------------------------------------------------------------
 (Outcome y==low is the comparison group)
 
 . predict xb1, outcome(low)      [can predict for base category]

 . drop xb2
 
 . predict xb2, outcome(2)        [VALUE works]
 
 . drop xb2
 
 . predict xb2, outcome(med)      [LABEL works]
 
 . drop xb2
 
 . predict xb2, outcome(#2)       [equation # works]
The Stata Blog: Not Elsewhere Classified Find us on Facebook Follow us on Twitter LinkedIn Google+ Watch us on YouTube