UCLA Academic Technology Services HomeServicesClassesContactJobs
Search

Stata Code Fragment: 
Getting Adjusted Values in Probit

Say you have a design that looks like a 2 by 2 factorial ANCOVA, but your dependent variable is a 0/1 variable.  In such a case, using a normal ANCOVA is not really appropriate since the variable is 0/1, so instead you use probit.  You code the data using dummy codes to indicate the main effect of factor 1 (b1) the main effect of factor 2 (b2) and the interaction (b1 * b2 = b3), and you have a covariate. You then run the probit as shown below  

clear 
input y cell b1 b2 b3 cov1 
0 1 0 0 0 43 
1 1 0 0 0 54 
0 1 0 0 0 44 
0 2 0 1 0 49 
1 2 0 1 0 45 
1 2 0 1 0 42 
0 3 1 0 0 54 
1 3 1 0 0 34 
1 3 1 0 0 56 
0 4 1 1 1 45 
0 4 1 1 1 67 
1 4 1 1 1 54 
end

probit y  b1 b2 b3 cov1
Probit estimates                                  Number of obs   =         12
                                                  LR chi2(4)      =       1.48
                                                  Prob > chi2     =     0.8300
Log likelihood = -7.5772029                       Pseudo R2       =     0.0890

------------------------------------------------------------------------------
       y |      Coef.   Std. Err.       z     P>|z|       [95% Conf. Interval]
---------+--------------------------------------------------------------------
      b1 |   .8854965   1.063108      0.833   0.405      -1.198157     2.96915
      b2 |   .8240042   1.060277      0.777   0.437        -1.2541    2.902108
      b3 |  -1.575389   1.551571     -1.015   0.310      -4.616412    1.465635
    cov1 |  -.0188094   .0544449     -0.345   0.730      -.1255194    .0879006
   _cons |    .466865   2.699602      0.173   0.863      -4.824257    5.757987
------------------------------------------------------------------------------

Then, if you want to get predicted probabilities for each cell, but adjusted for the covariate, you use the adjust command below.  Note that by(cell) is just giving you the probabilities for the 4 cells of the 2 by 2.

adjust cov, by(cell) pr ci

The output is shown below, with the predicted probabilities and the confidence intervals.

-------------------------------------------------------------------------------
Dependent variable: y     Command: probit
Variables left as is: b1, b2, b3
Covariate set to mean: cov1 = 48.916668
-------------------------------------------------------------------------------

----------+-----------------------------------
     cell |         pr          lb          ub
----------+-----------------------------------
        1 |    .325193    [.028601    .840207]
        2 |    .644598    [.125401    .970618]
        3 |    .667227    [.144304     .97293]
        4 |     .37482    [.028089    .898211]
----------+-----------------------------------
Key:  pr         =  Probability
      [lb , ub]  =  [95% Confidence Interval]

How to cite this page

Report an error on this page

UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services


The content of this web site should not be construed as an endorsement of any particular web site, book, or software product by the University of California.