Programming the statistical procedures from SAS

Bayesian robust binomial regression with PROC MCMC

Occasional Contributor
Posts: 11

Bayesian robust binomial regression with PROC MCMC

I haven't found any examples of robust binomial regression (called 'Robit regression by Gelman and others) online for PROC MCMC. I thought I'd post a simulation, analysis and results for anyone who might be interested or have comments. Based on the simulation of 'polluted' data, the robust model has better coverage over the true parameter values.


SAS needs to take advantage of multi-core processors by offering simultaneous multiple chains in MCMC. The Stan software can do that....


data x(drop = a b); ******** simulate Bernoulli data y with predictor x;
					******* Output twice to run probit, then robit model;
	retain a -1 b 2; *** 'True' values;
	do model = 1,2;
	do sample = 1 to 10;
    do x = -1 to 1 by 0.02;
		eta = a + b*x;
        	y = rand("BERNOULLI",cdf("NORMAL",eta,0,1));
		x = -1; y = 1; output;
		x = -0.7; y = 1; output;

****** model results using either standard probit or robit model;
ods output postsumint=Results;
proc mcmc data= x nmc=1000 nbi=1000 alg= nuts init=random monitor=(_parms_);
    parms a b ;
    prior a b ~ normal(0, sd=1);
			if model = 1 then p = cdf("NORMAL",a+b*x,0,1);	*** standard probit;
	else 	if model = 2 then p = cdf("T",a+b*x,1,0) ;		**** robust;
    model y ~ binary(p);
	by model sample;
ods output close;

proc format; 	value model 1 = "Standard Probit" 2 ="Robust Robit"; run;

**** reference lines of true values for plotting;
data refs;
	do model = 1 to 2;
		parameter = 'a'; xline=-1; output;
		parameter = 'b'; xline = 2; output;

data plotIt; 	set results refs; run;

ods graphics on / reset = all;
proc sgpanel data= PlotIt;
	panelby parameter model / rows=2 columns=2 layout=lattice novarname headerattrs=(size = 0.5cm);
	scatter x=mean y = sample / xerrorlower=hpdlower xerrorupper=hpdupper noerrorcaps;
	format model model.;
	refline xline / axis=x;
	where parameter in ('a','b');
ods graphics off;
Ask a Question
Discussion stats
  • 0 replies
  • 1 in conversation