SPSS Statistics

SPSS Statistics

Your hub for statistical analysis, data management, and data documentation. Connect, learn, and share with your peers! 

 View Only
  • 1.  Binary probit - Average marginal effects and standad errors

    Posted Mon July 28, 2025 12:58 PM

    I run binary probit regressions using the "Generalized Linear Models" procedure. Having done that, I would like to obtain marginal effects for changes in predictors of interest. Please note that all predictors are binary and that I would like to obtain average marginal effects, NOT marginal effects at the mean (i.e., marginal effects of a predictor when the other predictors are at the observed value, not their mean value). Besides the average marginal effects I would also like to obtain their standard errors.

    Can this be done within SPSS Statistics (I have v.29)? I know that R and Stata, among others, can produce these but, as I am not familiar with those packages, I am hoping that SPSS can do that as well. 

    Thanks.

    Please note that, for the next two weeks, I won't be able to respond timely to queries.



    ------------------------------
    Alberto Paloni
    ------------------------------


  • 2.  RE: Binary probit - Average marginal effects and standad errors

    Posted Thu August 07, 2025 02:05 AM

    Hi Paloni,

    SPSS does not currently offer a built-in point-and-click procedure for computing Average Marginal Effects (AMEs) after a probit regression. However, you can compute AMEs and their standard errors manually using the GENLIN procedure and some additional syntax in a roundabout way.

    * 1. Create example dataset (replace with your actual data)
     
    DATA LIST FREE /dep_var (F1) predictor1 (F1) predictor2 (F1).
    BEGIN DATA
    1 1 0 
    1 0 1
    0 1 0
    0 0 1
    1 1 1
    0 0 0
    1 0 0
    0 1 1
    END DATA.
    VARIABLE LABELS dep_var 'Binary Outcome' predictor1 'Binary Predictor 1' predictor2 'Binary Predictor 2'.
    VARIABLE LEVEL dep_var predictor1 predictor2 (NOMINAL).
    EXECUTE.
     
    * 2. First run probit model to check for separation issues
     
    GENLIN dep_var BY predictor1 predictor2
      /MODEL predictor1 predictor2 INTERCEPT=YES
      DISTRIBUTION=BINOMIAL LINK=PROBIT
      /CRITERIA METHOD=FISHER(1) SCALE=1 MAXITERATIONS=100
      /PRINT SUMMARY SOLUTION
      /SAVE MEANPRED(pred_prob).
     
    * 3. Save original dataset
     
    DATASET NAME original.
    DATASET COPY for_analysis.
    DATASET ACTIVATE for_analysis.
     
    * 4. Calculate AME for predictor1
    * Save original values
     
    COMPUTE orig_p1 = predictor1.
    COMPUTE orig_p2 = predictor2.
     
    * Case 1: Set predictor1=1 for all
     
    COMPUTE predictor1 = 1.
    EXECUTE.
    GENLIN dep_var BY predictor1 predictor2
      /MODEL INTERCEPT=YES
      DISTRIBUTION=BINOMIAL LINK=PROBIT
      /SAVE MEANPRED(pred_p1_set1).
     
    * Case 2: Set predictor1=0 for all
     
    COMPUTE predictor1 = 0.
    EXECUTE.
    GENLIN dep_var BY predictor1 predictor2
      /MODEL INTERCEPT=YES
      DISTRIBUTION=BINOMIAL LINK=PROBIT
      /SAVE MEANPRED(pred_p1_set0).
     
    * Compute AME for predictor1
     
    COMPUTE ame_predictor1 = pred_p1_set1 - pred_p1_set0.
    COMPUTE predictor1 = orig_p1.
     
    * 5. Calculate AME for predictor2
    * Case 1: Set predictor2=1 for all
     
    COMPUTE predictor2 = 1.
    EXECUTE.
    GENLIN dep_var BY predictor1 predictor2
      /MODEL INTERCEPT=YES
      DISTRIBUTION=BINOMIAL LINK=PROBIT
      /SAVE MEANPRED(pred_p2_set1).
     
    * Case 2: Set predictor2=0 for all
     
    COMPUTE predictor2 = 0.
    EXECUTE.
    GENLIN dep_var BY predictor1 predictor2
      /MODEL INTERCEPT=YES
      DISTRIBUTION=BINOMIAL LINK=PROBIT
      /SAVE MEANPRED(pred_p2_set0).
     
    * Compute AME for predictor2
     
    COMPUTE ame_predictor2 = pred_p2_set1 - pred_p2_set0.
    COMPUTE predictor2 = orig_p2.
     
    * 6. Display AME results
     
    DESCRIPTIVES VARIABLES=ame_predictor1 ame_predictor2
      /STATISTICS=MEAN STDDEV SEMEAN.
     
    * 7. Clean up
     
    DATASET CLOSE original.

    SPSS does not support counterfactual prediction directly. For each binary predictor, you must manually set it to 1 and 0 across all cases and re-estimate the model to get the predicted probabilities under each condition. If a model does not converge after setting a variable to 1 or 0 (e.g., due to perfect prediction), the resulting AME will be invalid. Please check model output after each run.

     



    ------------------------------
    Aruna Saraswathy
    Statistician
    SPSS Statistics
    IBM
    ------------------------------



  • 3.  RE: Binary probit - Average marginal effects and standad errors

    Posted Mon August 11, 2025 06:27 AM

    Thank you Aruna for this. I have not tried it yet but it looks promising. Could this be applied to the calculation of marginal effects after the Heckman regression (for selection bias)? At first sight, I do not see why not; my uncertainty is for the treatment of the Inverse Mills Ratio coefficient. 

    Many thanks.

    Alberto



    ------------------------------
    Alberto Paloni
    ------------------------------