/*STATA PROGRAM FOR REFERENDUM EXAMPLE*/ #delimit ; set mem 30m; set matsize 800; set more off; set logtype text; log using c:\Klaus\apec64\spring_07\stata\logs\dc_example, replace; use c:\Klaus\apec64\spring_07\stata\data\dc_data; /*****************************************************************************/ /* STEP 1: get frequency table for bid acceptance for non-parametric analysis*/ /*****************************************************************************/ tab bid choice; /*****************************************************************************/ /* STEP 2: Run probit models based on Cameron's framework, generate WTP predictions and examine marginal effects */ /*****************************************************************************/ /*Absolute WTP */ /***************/ /* predictions */ probit choice bid out_past num_out secfue_h business medical over64 hh_size inc000; gen wtp1=(-1/_b[bid])* (_b[_cons]+_b[out_past]*out_past+_b[num_out]*num_out+_b[secfue_h]*secfue_h+_b[business]*business+_b[medical]*medical+_b[over64]*over64+_b[hh_size]*hh_size+_b[inc000]*inc000); sum wtp1,det; sum wtp1 if wtp1<0; sum wtp1 if wtp1>0; /* marginal effects */ dprobit choice bid out_past num_out secfue_h business medical over64 hh_size inc000; /*Log WTP */ /***************/ gen lnbid =log(bid); /* predictions */ probit choice lnbid out_past num_out secfue_h business medical over64 hh_size inc000; scalar sig=(-1/_b[lnbid]);/* estimated error standard deviation */ scalar list sig; gen lnwtp=(-1/_b[lnbid])* (_b[_cons]+_b[out_past]*out_past+_b[num_out]*num_out+_b[secfue_h]*secfue_h+_b[business]*business+_b[medical]*medical+_b[over64]*over64+_b[hh_size]*hh_size+_b[inc000]*inc000); gen wtp2=exp(lnwtp+0.5*sig^2); sum wtp2,det; gen medwtp=exp(lnwtp); sum medwtp; /* marginal effects */ dprobit choice lnbid out_past num_out secfue_h business medical over64 hh_size inc000; /*************************************************/ /* Step 3: Predictions for a specific household */ /************************************************/ /* out_past=5, num_out=3, secfue_h=0, business=0, medical=1, over64=1, hh_size=5, inc000=60 */ /* For model with absolute wtp:*/ probit choice bid out_past num_out secfue_h business medical over64 hh_size inc000; nlcom (-1/_b[bid])* (_b[_cons]+_b[out_past]*5+_b[num_out]*3+_b[secfue_h]*0+_b[business]*0+_b[medical]*1+_b[over64]*1+_b[hh_size]*5+_b[inc000]*60); /* For model with log wtp:*/ probit choice lnbid out_past num_out secfue_h business medical over64 hh_size inc000; nlcom exp((-1/_b[lnbid])* (_b[_cons]+_b[out_past]*5+_b[num_out]*3+_b[secfue_h]*0+_b[business]*0+_b[medical]*1+_b[over64]*1+_b[hh_size]*5+_b[inc000]*60)); log close;