%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Domestic violence model%
%
% Using ranked vars where discontinuities%
% Random term: District(random) in addition to the%
% commune level Khumcode(spatial) term%
%
% Negative binomial family%
% Long form = stacked, one observation for each year %
%
% 102,000 iterations
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

logopen using C:\[path to log file]\DomViol3Y051115b.rtf

% Assuming data and map not yet read in:%
dataset cambod3y
cambod3y.infile, maxobs=5000 using C:\[path to data file]\CambodiaViol3YLongFormBayesX051017.txt

bayesreg hhvio3y051115b

hhvio3y051115b.outfile = C:\[path to output subdir]\hhvio3y051115b

% Assuming data and map not yet read in:%
map m1
m1.infile, graph using C:\[path to commune adjacency graph file]\cam.bayesx.queen_connect.graph
m1.reorder

hhvio3y051115b.regress HHVIOL = LOGFAMIL(offset) + is2003 + is2004 + LOG_MA_A +  LOG_LOAD(psplinerw2) + FGT_2 + rankFHHHRT(psplinerw2) +  rankPOPDNS(psplinerw2) +  rankLPOP9802(psplinerw2) + MALELITR +  rankTOILET(psplinerw2) + WATALL(psplinerw2) +  rankF614SL(psplinerw2) + DIST_COD(random)  + KHUMCODE(spatial, map=m1), family=nbinomial iterations=102000 burnin=2000 step=10 predict  using cambod3y

hhvio3y051115b.plotautocor, mean

logclose
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
