%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Serious crime model%

% Using ranked vars where discontinuities%
% Random terms: 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]\SeriousCrime3Y051115b.rtf

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

bayesreg crime3y051115b
crime3y051115b.outfile = C:\Cambodia_Owen_Benini\Analyses\Analyses051115b3\crime3y051115b

% 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

crime3y051115b.regress INSEC = 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

crime3y051115b.plotautocor, mean

logclose