Resources

Bayesian Censored Model


/*--------------------------------------------------------------

                    SAS Sample Library

        Name: qliex08.sas
 Description: Example program from SAS/ETS User's Guide,
              The QLIM Procedure
       Title: Bayesian Censored Model
     Product: SAS/ETS Software
        Keys: Bayesian limited dependent variables
        PROC: QLIM
       Notes:

--------------------------------------------------------------*/

title1 'Bayesian Analysis';

ods graphics on;

data test;
   do i=1 to 200;
      e1 = rannor(8726)*2000;
      WinChance = ranuni(8772);
      Price = 10+ranexp(8773)*4;
      y = 48000 + 5000*WinChance - 100 * price +  e1;
      if y>50000 then TicketSales = 50000;
      if y<=50000 then TicketSales = y;
      output;
   end;
   keep WinChance price  y TicketSales;
run;

proc qlim data=test plots(prior)=all;
   model TicketSales = WinChance price;
   endogenous TicketSales ~ censored(lb=0 ub= 50000);
   prior intercept~normal(mean=48000);
   prior WinChance~normal(mean=5000);
   prior Price~normal(mean=-100);
   bayes NBI=10000 NMC=30000 THIN=1 ntrds=1 DIAG=ALL STATS=ALL seed=2;
run;