-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlcoholModel.java
More file actions
4261 lines (3795 loc) · 170 KB
/
AlcoholModel.java
File metadata and controls
4261 lines (3795 loc) · 170 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* Alcohol ABM
*
* This model will compare interventions aimed at reducing racial disparities in alcohol-related
* homicide, using New York City as the place and population of interest.
*
* The model class (1) creates the agents, neighborhoods, and physical space used by the model;
* (2) specifies the order of events occurring at each time step of the model; and (3) creates step reports
* and summary files of model results, as well as graphical displays of agent and neighborhood characteristics
* during the model run.
*
* Revised May 26, 2015
*
* Revisions: June 2015 version adds alcohol interventions
* -- intervention "2" randomly selects certain percentages of outlets to close
* -- intervention "3" selects certain percentage of highest violence outlets to close
* -- intervention "6" taxes alcohol
*/
package cbtModel;
import java.io.*;
import java.util.*;
import java.awt.event.ActionEvent;
import java.awt.Color;
import org.joone.edit.jedit.InputHandler.insert_break;
import uchicago.src.sim.analysis.DataRecorder;
import uchicago.src.sim.analysis.Histogram;
import uchicago.src.sim.analysis.NumericDataSource;
import uchicago.src.sim.analysis.OpenSequenceGraph;
import uchicago.src.sim.analysis.OpenHistogram;
import uchicago.src.sim.analysis.BinDataSource;
import uchicago.src.sim.engine.AbstractGUIController;
import uchicago.src.sim.engine.ActionGroup;
import uchicago.src.sim.engine.BasicAction;
import uchicago.src.sim.engine.Schedule;
import uchicago.src.sim.engine.SimInit;
import uchicago.src.sim.engine.SimModelImpl;
import uchicago.src.sim.engine.SimpleModel;
import uchicago.src.sim.gui.ColorMap;
import uchicago.src.sim.gui.Value2DDisplay;
import uchicago.src.sim.gui.DisplaySurface;
import uchicago.src.sim.gui.Object2DDisplay;
import uchicago.src.sim.space.Object2DGrid;
import uchicago.src.sim.space.Object2DTorus;
import uchicago.src.sim.util.Random;
import uchicago.src.sim.util.SimUtilities;
import cern.jet.math.*;
public class AlcoholModel extends SimModelImpl {
// variable declarations
private Schedule schedule;
private Object2DGrid agentSpace;
private Object2DGrid hoodSpace;
private DisplaySurface displaySurf;
private DataRecorder recorder;
private OpenSequenceGraph agentTime;
private OpenSequenceGraph agentNumber;
private OpenSequenceGraph hoodTime;
private OpenSequenceGraph hoodChar;
// MODEL INITIALIZATION PARAMETERS AND DEFAULT VALUES
// agent and world set-up
private int numAgents=513000;
private int worldXsize=400;
private int worldYsize=625;
private int numHoods=59;
private int numOutreach=1; // number of outreach workers per neighborhood
// duration of burn-in period and model run
private int startAging=10;
private int stopModelRun=500;
// behavioral and influence parameters
private int lookForVictims=15; // radius to look for victims of violence
private double alpha=0.10; // neighborhood influence on drinking and violence
private double network_alpha=0.15; // social network influence on drinking and violence
private int allowDeath=1; // 0 -- no mortality; 1 -- agent deaths allowed
private int agentRecycle=1; // 0 -- no recycling; 1 -- deceased agent replaced with 18-year-old
// output and displays
private int displayGUI=0; // display grid of neighborhoods with agents pictured
private int outputAgentSteps=0; // output agent step report, to check model as needed
private int outputHoodSteps=1; // output neighborhood step report, to check model as needed
// interventions
private int intervention=0; // 0 -- no intervention, 1 -- increased social norms re: unacceptability of drunkenness
// 2 -- decreased outlet density across all neighborhoods,
// 3 -- decreased number of most violent outlets in city
// 4 -- increased community policing, 5 -- violence interrupters
// 6 -- alcohol taxation, 7 -- close outlets early
// 8 -- combined policing and violence interrupters
// 9 -- decreased number of outlets in neighborhoods with highest outlet density
// 10 -- close outlets early in neighborhoods with high outlet density
private int intTarget=0; // 0 -- universal, 1 -- targeted
private double intChange=0; // amount by which intervention increases or decreases
private int intDuration=0; // number of years to continue intervention
// PARAMETERS TO BE INCLUDED IN CONTROL PANEL
public String[] getInitParam() {
String[] initParams = { "NumAgents", "WorldXsize", "WorldYsize", "NumHoods",
"StartAging", "StopModelRun", "DisplayGUI", "LookForVictims", "LookForPolice", "Alpha", "Network_alpha",
"OutputAgentSteps", "OutputHoodSteps", "AllowDeath", "AgentRecycle",
"Intervention", "IntTarget", "IntChange", "IntDuration",
"LookForViolence", "LookForViolOutlets", "ReduceViol", "NumOutreach"};
return initParams;
}
// CREATE STEP REPORT FILES
// CREATE LISTS OF AGENTS, NEIGHBORHOODS, AND OUTLETS
// Lists of agents and neighborhoods
public ArrayList<AlcoholAgent> agentList; // list of all agents
public ArrayList<AlcoholAgent> tempagentList; // temporary list of all agents, to use when shuffling
public ArrayList<AlcoholAgent> wagentList; // list of all white agents
public ArrayList<AlcoholAgent> bagentList; // list of all black agents
public ArrayList<AlcoholAgent> hagentList; // list of all hispanic agents
public ArrayList<AlcoholAgent> oagentList; // list of all other race agents
public ArrayList<AlcoholAgent> magentList; // list of male agents
public ArrayList<AlcoholAgent> fagentList; // list of female agents
public ArrayList<AlcoholAgent> lesshsagentList; // list of all agents with < high school education
public ArrayList<AlcoholAgent> hsagentList; // list of all agents with high school education or equivalent
public ArrayList<AlcoholAgent> morehsagentList; // list of all agents with more than a high school education
public ArrayList<AlcoholAgent> baseNonDrkList; // list of all agents who were non-drinkers at baseline
public ArrayList<AlcoholAgent> baseLightDrkList;// list of all agents who were light/moderate drinkers at baseline
public ArrayList<AlcoholAgent> baseHeavyDrkList;// list of all agents who were heavy drinkers at baseline
public ArrayList<AlcoholNeighborhood> hoodList; // list of all neighborhoods
public ArrayList<AlcoholNeighborhood> temphoodList; // temporary list of all neighborhoods
// Social network variables
public static int numNodes;
public static ArrayList<AlcoholAgent> SocialNetworkList;
// VARIABLES FOR GRAPHS AND OUTPUT FILES
// variables storing data for graphs and output files
private int numHeavyDrk;
private double percHeavyDrk;
private int numViolvict;
private double percViolvict;
private int numPriorviolvict;
private double percPriorviolvict;
private int numViolperp;
private double percViolperp;
private int numPriorviolperp;
private double percPriorviolperp;
private int numDied;
private double percDied;
private int numMoved;
private double percMoved;
private double avgHoodinc;
private double avgHoodviol;
private double avgHoodstable;
private double avgHoodheavy;
private int baselinePolice;
// INITIALIZING MODEL
public static void main(String[] args) {
SimInit init = new SimInit();
AlcoholModel model = new AlcoholModel();
init.loadModel(model, null, false);
}
public String getName() {
return "AlcoholModel";
}
// Setup model
public void setup() {
System.out.println("Running setup");
// Reset world where agents are located
agentSpace = null;
hoodSpace = null;
// Only display grid with agent locations when not in multi-run (batch model) mode
if (displayGUI == 1) {
if (displaySurf != null) {
displaySurf.dispose();
}
displaySurf = null;
displaySurf = new DisplaySurface(this, "ViolenceCells");
registerDisplaySurface("ViolenceCells", displaySurf);
}
// Reset list of agents
agentList = new ArrayList<AlcoholAgent>();
tempagentList = new ArrayList<AlcoholAgent>();
// Reset race-specific lists of agents
wagentList = new ArrayList<AlcoholAgent>();
bagentList = new ArrayList<AlcoholAgent>();
hagentList = new ArrayList<AlcoholAgent>();
oagentList = new ArrayList<AlcoholAgent>();
// Reset gender-specific lists of agents
magentList = new ArrayList<AlcoholAgent>();
fagentList = new ArrayList<AlcoholAgent>();
// Reset education-specific lists of agents
lesshsagentList = new ArrayList<AlcoholAgent>();
hsagentList = new ArrayList<AlcoholAgent>();
morehsagentList = new ArrayList<AlcoholAgent>();
// Reset drinking-specific lists of agents
baseNonDrkList = new ArrayList<AlcoholAgent>();
baseLightDrkList = new ArrayList<AlcoholAgent>();
baseHeavyDrkList = new ArrayList<AlcoholAgent>();
// Reset social network list
SocialNetworkList = new ArrayList<AlcoholAgent>();
// Reset list of neighborhoods
hoodList = new ArrayList<AlcoholNeighborhood>();
temphoodList = new ArrayList<AlcoholNeighborhood>();
// Reset schedule
schedule = new Schedule(1);
} // end of setup
public void begin() {
buildModel();
buildSchedule();
}
/////////////////////////////////////// BUILD MODEL ///////////////////////////////////////
/*
* buildModel
* This part of the program creates the agent population, creates neighborhoods, and assigns agents to neighborhoods.
* The buildModel function also creates displays to view model output in real-time as the model
* runs, and creates output files containing summary statistics as well as values of all variables at each time step.
*
* 1 - Start random number generator
* 2 - Create physical space
* 3 - Create display surface to view physical space during the model run
* 4 - Create agents
* 5 - Create neighborhoods
* 6 - Assign agents to neighborhoods
* 7 - Calculate baseline neighborhood characteristics and assign to resident agents
* 8 - Assign preliminary substance use status
* 9 - Select initial alcohol outlet for drinking (and some non-drinking) agents
* 10 - Create social network linking agents to each other
* 11 - Create output files, step reports, and graphs of characteristics during the model run
*
*/
public void buildModel() {
System.out.println("Running BuildModel");
System.out.println("Checking model: intervention = " + (int)getIntervention() + " and change = " + (int)(getIntChange()*100) + " and # steps = " + (int)getStopModelRun());
// 1 - START RANDOM NUMBER GENERATOR
buildModelStart();
// 2 - CREATE PHYSICAL SPACE WHERE AGENTS RESIDE
agentSpace = new Object2DGrid(worldXsize, worldYsize);
hoodSpace = new Object2DGrid(worldXsize, worldYsize);
// 3 - CREATE DISPLAY SURFACE TO VIEW THE PHYSICAL SPACE DURING THE MODEL RUN
if (displayGUI == 1) {
displaySurf.addDisplayable(new Object2DDisplay(hoodSpace), "ViolenceCells");
displaySurf.addDisplayable(new Object2DDisplay(agentSpace), "AgentWorld");
displaySurf.display();
}
// 4 - CREATE AGENTS - including assignment of household income
numNodes = numAgents; // number of nodes for use in social network
for (int i=0; i<numAgents; i++) {
AlcoholAgent a = new AlcoholAgent();
agentList.add(a);
tempagentList.add(a);
}
System.out.printf("Created %d agents \n", agentList.size());
// Create race-, gender-, and education-specific lists of agents
for (int i=0; i<agentList.size(); i++) {
AlcoholAgent a = (AlcoholAgent)agentList.get(i);
if (a.getRace()==1) {wagentList.add(a);}
else if (a.getRace()==2) {bagentList.add(a);}
else if (a.getRace()==3) {hagentList.add(a);}
else if (a.getRace()==4) {oagentList.add(a);}
if (a.getGender()==1) {magentList.add(a);}
else if (a.getGender()==0) {fagentList.add(a);}
if (a.getEducation()==1) {lesshsagentList.add(a);}
else if (a.getEducation()==2) {hsagentList.add(a);}
else if (a.getEducation()==3) {morehsagentList.add(a);}
}
// 5 - CREATE NEIGHBORHOODS
for (int j=0; j<numHoods; j++) {
AlcoholNeighborhood nb = new AlcoholNeighborhood(j, hoodSpace);
hoodList.add(nb);
temphoodList.add(nb);
//System.out.printf("Created %d cells in neighborhood %d \n", nb.neighborhoodCellList.size(), nb.getID());
}
System.out.printf("Created %d neighborhoods \n", hoodList.size());
// 6 - ASSIGN AGENTS TO NEIGHBORHOODS
// Assign agents to neighborhoods so that neighborhoods match 59 NYC CDs as of 2000 in terms of
// age, gender, race, household income, and population size
for (int i=0; i<agentList.size(); i++) {
AlcoholAgent a = (AlcoholAgent)agentList.get(i);
double randPopProb = Random.uniform.nextDoubleFromTo(0, 1);
for (int j=0; j<hoodList.size(); j++) {
if (randPopProb > a.popDist[j] && randPopProb <= a.popDist[j+1]) {
a.setAgenthood(j);
AlcoholNeighborhood nb = (AlcoholNeighborhood)hoodList.get(j);
nb.neighborhoodAgentList.add(a);
nb.temphoodAgentList.add(a);
a.setAgenthood(nb.getID());
a.setCdcode(nb.getCdcode());
// Select X, Y location for agent within neighborhood boundaries
int agentX= nb.getnb_minX() + (int)(Math.random() * (nb.getnb_maxX() - nb.getnb_minX()));
int agentY= nb.getnb_minY() + (int)(Math.random() * (nb.getnb_maxY() - nb.getnb_minY()));
a.setX(agentX);
a.setY(agentY);
agentSpace.putObjectAt(agentX, agentY, a);
// Notify cell that agent is present
AlcoholCell newCell = (AlcoholCell)hoodSpace.getObjectAt(agentX, agentY);
newCell.setMyAgent(a);
newCell.setAgentIncome(a.getHouseincome());
break;
}
}
}
// 7 - CALCULATE BASELINE NEIGHBORHOOD CHARACTERISTICS AND ASSIGN TO RESIDENT AGENTS
// ALSO, CREATE PATROL AREAS FOR USE WITH TARGETED POLICING INTERVENTION
// Calculate average neighborhood characteristics at baseline
for (int t=0; t<hoodList.size(); t++) {
AlcoholNeighborhood NB = (AlcoholNeighborhood)hoodList.get(t);
setNBincome(NB);
setNBviol(NB);
setNBracecomp(NB);
setNBstability(NB);
setNByoungmale(NB);
setNBheavydrk(NB);
setNBmeanage(NB);
// calculate neighborhood alcohol outlet density
}
// Identify neighborhoods with high levels of outlet density
// Defined as top 25%
Collections.sort(temphoodList, new Comparator() {
public int compare(Object w1, Object w2) {
AlcoholNeighborhood n1 = (AlcoholNeighborhood) w1;
AlcoholNeighborhood n2 = (AlcoholNeighborhood) w2;
// sort list in descending order, so that highest outlet density neighborhoods are first
if (n1.getOutletdens() < n2.getOutletdens()) return 1;
return 0;
}
});
for (int w=0; w<15; w++) {
AlcoholNeighborhood nb = (AlcoholNeighborhood)temphoodList.get(w);
nb.setHighdens(1);
}
// Identify neighborhoods with high levels of income and violence
for (int t=0; t<hoodList.size(); t++) {
AlcoholNeighborhood nb = (AlcoholNeighborhood)hoodList.get(t);
if (nb.getAvghoodinc() > getAvgHoodinc()) {nb.setHighhoodinc(1);}
else {nb.setHighhoodinc(0);}
if (nb.getAvghoodviol() > getAvgHoodviol()) {nb.setHighhoodviol(1);}
else {nb.setHighhoodviol(0);}
}
// Assign neighborhood characteristics to cells located in that neighborhood
for (int i=0; i<worldXsize; i++) {
for (int j=0; j<worldYsize; j++) {
AlcoholCell newCell = (AlcoholCell)hoodSpace.getObjectAt(i,j);
int cellID = newCell.getHoodID();
AlcoholNeighborhood cellHood = (AlcoholNeighborhood)hoodList.get(cellID);
newCell.setHighhoodinc(cellHood.getHighhoodinc());
newCell.setHighhoodviol(cellHood.getHighhoodviol());
}
}
// Identify whether agents live in high or low income neighborhoods at baseline
for (int i=0; i<agentList.size(); i++) {
AlcoholAgent a = (AlcoholAgent)agentList.get(i);
AlcoholNeighborhood nb = (AlcoholNeighborhood)hoodList.get(a.Agenthood);
if (nb.getHighhoodinc()==1) { a.setEverHighInc(1); }
else if (nb.getHighhoodinc()==0) { a.setEverLowInc(1); }
if (a.getEverHighInc()==1) { a.setBaseIncHood(1); }
else if (a.getEverLowInc()==1) { a.setBaseIncHood(2); }
}
// 8 - ASSIGN PRELIMINARY DRINKING STATUS
// Assign preliminary drinking status and preference for drinking in public place (i.e., for on-premises outlet)
// as well as type of beverage preferred
// Based on individual-level and neighborhood-level variables
// baseline drinking status
for (int i=0; i<agentList.size(); i++) {
AlcoholAgent a = (AlcoholAgent)agentList.get(i);
// drinking status
drinkingProb(a);
// create lists of agents by drinking status at baseline
if (a.getDrinkStat()==1) { baseNonDrkList.add(a); }
else if (a.getDrinkStat()==2) { baseLightDrkList.add(a); }
else if (a.getDrinkStat()==3) { baseHeavyDrkList.add(a); }
}
// 8b - CALCULATE ADDITIONAL NEIGHBORHOOD-LEVEL VARIABLES
// Calculate average neighborhood characteristics related to drinking at baseline
for (int t=0; t<hoodList.size(); t++) {
AlcoholNeighborhood NB = (AlcoholNeighborhood)hoodList.get(t);
setNBlightdrk(NB);
setNBheavydrk(NB);
}
// 10 - CREATE SOCIAL NETWORK
createSocialNetwork();
// Count number of friends who are abstainers, light/moderate drinkers, and heavy drinkers
// and proportion of friends with negative attitudes towards drinking
for (int i=0; i<agentList.size(); i++) {
int numNoDrk = 0, numLightDrk = 0, numHeavyDrk = 0, numNegAtt = 0;
AlcoholAgent a = (AlcoholAgent)agentList.get(i);
for (int w=0; w<a.getTotalFriends(); w++) {
if (a.friendList.get(w).getDrinkStat()==1) { numNoDrk += 1; }
else if (a.friendList.get(w).getDrinkStat()==2) { numLightDrk += 1; }
else if (a.friendList.get(w).getDrinkStat()==3) { numHeavyDrk += 1; }
}
a.setNumFrdNoDrk(numNoDrk);
a.setNumFrdLightDrk(numLightDrk);
a.setNumFrdHeavyDrk(numHeavyDrk);
}
// 11 - CREATE OUTPUT FILES, STEP REPORTS, AND GRAPHS OF AGENT CHARACTERISTICS DURING THE MODEL RUN
// Record output to file
// NOTE: this function is included at the end of the file
recordOutput();
// Record neighborhood-specific output to file
// NOTE: this function is only needed to check distributions of neighborhood characteristics
// recordHoodOutput();
// Graph agent characteristics during model run
if (displayGUI == 1) {
// Graph agent characteristics
agentTime = new OpenSequenceGraph("Agent characteristics over time", this);
agentTime.setXRange(0.0, 40.0);
agentTime.setYRange(0.0, 100.0);
agentTime.createSequence("% heavy drinker", this, "getPercHeavyDrk");
agentTime.createSequence("% victimization", this, "getPercViolvict");
agentTime.createSequence("% ever victimized", this, "getPercPriorviolvict");
agentTime.createSequence("% perpetration", this, "getPercViolperp");
agentTime.createSequence("% ever perpetrated", this, "getPercPriorviolperp");
agentTime.createSequence("% died", this, "getPercDied");
agentTime.createSequence("% moved", this, "getPercMoved");
agentTime.display();
// Graph neighborhood characteristics ranging from 0 to 1
hoodTime = new OpenSequenceGraph("Neighborhood characteristics over time", this);
hoodTime.setXRange(0.0, 40.0);
hoodTime.setYRange(0.0, 1.0);
hoodTime.createSequence("Avg hood violence", this, "getAvgHoodviol");
hoodTime.createSequence("Percent heavy drinkers", this, "getAvgHoodheavy");
hoodTime.createSequence("Percent 5 yr residents", this, "getAvgStable");
hoodTime.display();
/*
// Histogram of number of light and heavy drinkers at outlets
chartOutlet = new OpenHistogram("Outlets with light and heavy drinkers", 15, 0);
chartOutlet.setXRange(0, 30);
class outletLight implements BinDataSource {
public double getBinValue(Object o) {
AlcoholOutlet outlet = (AlcoholOutlet)o;
return (double) outlet.getNLightDrk();
}
}
class outletHeavy implements BinDataSource {
public double getBinValue(Object o) {
AlcoholOutlet outlet = (AlcoholOutlet)o;
return (double) outlet.getNHeavyDrk();
}
}
chartOutlet.createHistogramItem("# Light Drinkers", outletList, new outletLight(), 1, 0);
chartOutlet.createHistogramItem("# Heavy Drinkers", outletList, new outletHeavy(), 1, 0);
chartOutlet.display();
*/
}
// Create agent step report to check model run, as needed
if (outputAgentSteps == 1) {
if (agentStepReportFile != null)
endStepReportFile();
if (agentStepReportFileName.length() > 0) {
agentStepReportFile = startAgentStepReportFile();
}
// header line for step report output file -- listing all variable names
String header;
header = String.format( "tick agentID agentX agentY agentHood age age2 age3 age4 age5 age6 ");
header += String.format("gender race black hisp otherrace education hs morehs ");
header += String.format("baseincome houseincome inc2 inc3 inc4 died pviolvict potviolvict violvict lastviolvict priorviolvict ");
header += String.format("pviolperp potviolperp violperp lastviolperp priorviolperp ");
header += String.format("probnondrk problightdrk probheavydrk ");
header += String.format("lastdrinkstat drinkstat nondrk lightdrk heavydrk alcviol probhom homicide alchom ");
header += String.format("probmove moved duration dur1 dur2 dur3 everhighinc everlowinc baseinchood ");
header += String.format("assignfrd numfrd nodrkfrd moddrkfrd heavydrkfrd friendids closeearly");
writeLineToStepReportFile ( header );
stepReport();
}
// Create neighborhood step report to check model run, as needed
if (outputHoodSteps == 1) {
if (hoodStepReportFile != null)
endNBStepReportFile();
if (hoodStepReportFileName.length() > 0) {
hoodStepReportFile = startHoodStepReportFile();
}
// header line for step report output file -- listing all variable names
String header;
header = String.format( "tick hoodID avghoodinc lastavghoodinc changeinc ");
header += String.format("hoodinc hoodinc1 hoodinc2 highhoodinc avghoodviol lastavghoodviol changeviol highhoodviol ");
header += String.format("avghoodperp targethood pblack phisp pstable police ");
header += String.format("plight pheavy avgage phom palchom nagent ncell");
writeLineToNBStepReportFile ( header );
hoodStepReport();
}
} // end of buildModel
//////////////////////////////////////////// STEPS OF THE MODEL ////////////////////////////////////////////
/*
* buildSchedule
* This part of the program implements the functions that occur at each step of the model.
*
* Steps of the model
* 1 - Model stops when end condition is met
* 2 - Cell variables are reset
* 3 - Agents age one year
* 4 - Agent variables are reset
* 5 - Some agents die and are recycled
* 6 - Agents consider moving to a different neighborhood
* 7 - Update neighborhood characteristics after agent movement
* 8 - Drinking transitions and changes in preferred alcohol outlets (ALSO, ALCOHOL OUTLET INTERVENTION, when applicable)
* 9 - Update characteristics of alcohol outlets
* 10 - Reset locations of police officers (ALSO, POLICING INTERVENTION, when applicable)
* 11 - Identify potential victims and perpetrators of violence, including homicide
* 12 - Actual violent incidents take place
* 13 - Update neighborhood characteristics
* 14 - Grid of agent locations, real-time graphs, and output files are updated
*/
public void buildSchedule() {
System.out.println("Running BuildSchedule");
class ViolenceStep extends BasicAction {
@SuppressWarnings("unchecked")
public void execute() {
// 1 - Stop the model after the specified number of time steps
double currentTime = getTickCount();
System.out.println("Running step " + (int)getTickCount());
checkEndCondition();
// 2 - Reset cell and neighborhood variables for current time step
// Reset cell variables
for (int i=0; i < worldXsize; i++) {
for (int j=0; j < worldYsize; j++) {
AlcoholCell cell = (AlcoholCell)hoodSpace.getObjectAt(i, j);
cell.resetCellVars();
}
}
for (int i=0; i<agentList.size(); i++) {
AlcoholAgent a = (AlcoholAgent)agentList.get(i);
AlcoholNeighborhood nb = (AlcoholNeighborhood)hoodList.get(a.Agenthood);
nb.setTargetHood(0);
nb.setNumviolevent(0);
nb.setNumOutreach(0);
// 3 - Agents age one year (after burn-in period only)
if (getTickCount()>startAging){ a.age+=1;}
// 4 - Reset agent variables for current time step
// If agent died at last time step, reset relevant variables
if (getTickCount()>startAging && a.getDied()==1) { resetDeath(a); }
// Reset dummy variables and other indicators for all agents
if (getTickCount()<=startAging || (getTickCount()>startAging && a.getDied()==0)) {
a.resetVars(currentTime);
}
// 5 - Identify agents who will die at this time step
if (allowDeath == 1) {
// Update mortality probabilities to account for changes in age category
a.mortalityProb();
// Identify agents who die at the current time step (after burn-in period)
if (getTickCount()>startAging) {agentDeath(a);}
}
// 6 - Identify agents who move to a new neighborhood and find their new location
if (getTickCount()>startAging) {
// Recalculate moving probability based on duration of residence, income, and violence at last time step
a.movingProb();
// Identify agents who move
double randomPmove = Random.uniform.nextDoubleFromTo(0,1);
if (randomPmove < a.getPMove()) { a.setMoved(1); a.setDurationRes(0); }
else {a.setMoved(0); a.durationRes += 1;}
// Assign agents new location
if (a.getMoved()==1) {
// First, keep track of agent's old neighborhood but remove from agent list
AlcoholNeighborhood oldhood = (AlcoholNeighborhood)hoodList.get(a.getAgenthood());
oldhood.neighborhoodAgentList.remove(a);
oldhood.temphoodAgentList.remove(a);
// Second, update probabilities of living in each neighborhood based on current characteristics
a.hoodProbDist3();
a.hoodProbDist4();
// Third, select new neighborhood
double randPopProb = Random.uniform.nextDoubleFromTo(0, 1);
for (int j=0; j<hoodList.size(); j++) {
if (randPopProb > a.popDist[j] && randPopProb <= a.popDist[j+1] && j != a.getAgenthood()) {
a.setAgenthood(j);
AlcoholNeighborhood newhood = (AlcoholNeighborhood)hoodList.get(j);
newhood.neighborhoodAgentList.add(a);
newhood.temphoodAgentList.add(a);
a.setAgenthood(newhood.getID());
a.setCdcode(newhood.getCdcode());
// Select X, Y location for agent within neighborhood boundaries
int agentX= newhood.getnb_minX() + (int)(Math.random() * (newhood.getnb_maxX() - newhood.getnb_minX()));
int agentY= newhood.getnb_minY() + (int)(Math.random() * (newhood.getnb_maxY() - newhood.getnb_minY()));
a.setX(agentX);
a.setY(agentY);
agentSpace.putObjectAt(agentX, agentY, a);
// Notify cell that agent is present
AlcoholCell newCell = (AlcoholCell)hoodSpace.getObjectAt(agentX, agentY);
newCell.setMyAgent(a);
newCell.setAgentIncome(a.getHouseincome());
break;
}
}
}
}
} // end of agent loop
// 7 - Update neighborhood characteristics to reflect new residents after movement between neighborhoods
for (int t=0; t<hoodList.size(); t++) {
AlcoholNeighborhood NB = (AlcoholNeighborhood)hoodList.get(t);
// setNBviol(NB); // Note: not updating neighborhood violence because we want to keep consistent with previous time step
// setNBperp(NB); // not including violence history of people who moved into the area yet
setNBstability(NB);
setNByoungmale(NB);
setNBlightdrk(NB);
setNBheavydrk(NB);
setNBracecomp(NB);
setNBmeanage(NB);
if (getTickCount()>startAging) {setNBincome(NB);}
}
// Identify neighborhoods with high levels of income
for (int t=0; t<hoodList.size(); t++) {
AlcoholNeighborhood nb = (AlcoholNeighborhood)hoodList.get(t);
// if (nb.getAvghoodviol() > getAvgHoodviol()) {nb.setHighhoodviol(1);}
// else {nb.setHighhoodviol(0);}
if (nb.getAvghoodinc() > getAvgHoodinc()) {nb.setHighhoodinc(1);}
else {nb.setHighhoodinc(0);}
}
// Update neighborhood characteristics of cells located in that neighborhood
for (int i=0; i<worldXsize; i++) {
for (int j=0; j<worldYsize; j++) {
AlcoholCell newCell = (AlcoholCell)hoodSpace.getObjectAt(i,j);
int cellID = newCell.getHoodID();
AlcoholNeighborhood cellHood = (AlcoholNeighborhood)hoodList.get(cellID);
newCell.setHighhoodviol(cellHood.getHighhoodviol());
}
}
// Identify whether agents live in high or low income neighborhoods
for (int i=0; i<agentList.size(); i++) {
AlcoholAgent a = (AlcoholAgent)agentList.get(i);
AlcoholNeighborhood nb = (AlcoholNeighborhood)hoodList.get(a.Agenthood);
if (a.getMoved()==1) {
if (nb.getHighhoodinc()==1) { a.setEverHighInc(1); }
else if (nb.getHighhoodinc()==0) { a.setEverLowInc(1); }
}
}
// 8 - Drinking transitions and changes in preferred alcohol outlets
// ALCOHOL OUTLET DENSITY INTERVENTIONS ALSO OCCUR HERE WHEN IN EFFECT
// REDUCED OUTLET HOURS INTERVENTIONS ALSO OCCUR HERE WHEN IN EFFECT
/////////////////// EARLIER CLOSING TIMES
// Close certain percentage of outlets in each neighborhood early (randomly selected or
// in high-violence neighborhoods, or in neighborhoods with high outlet density)
// NOTE THAT THE INTERVENTION OCCURS ONLY ONCE IN THE MODEL (at time step 11)
// BUT OUTLETS REMAIN CLOSED EARLY FOR THE DURATION OF THE MODEL RUN
/////////////////////////////////////////////
// EARLIER CLOSING TIMES INTERVENTION #3 -- HIGH OUTLET DENSITY NEIGHBORHOODS
for (int i=0; i<agentList.size(); i++) {
AlcoholAgent a = (AlcoholAgent)agentList.get(i);
AlcoholNeighborhood nb = (AlcoholNeighborhood)hoodList.get(a.getAgenthood());
// Drinking transitions
// NOTE: ALCOHOL TAXATION INTERVENTION AFFECTS DRINKING TRANSITIONS IN THIS STEP
if (getTickCount()>startAging) { drinkingTrans(a); }
// Potential selection of a new preferred alcohol outlet
if (getTickCount()>startAging) {
// make sure all non-drinkers have correct (non) beverage preference
if (a.getDrinkStat() == 1) {
a.setPreferBeer(0);
a.setPreferWine(0);
a.setPreferSpirit(0);
}
// non-drinker who remained a non-drinker?
// current drinkers who made a transition in amount from last time step?
// re-calculate preferred drinking location and select preferred outlet of that type
}
} // end of agent loop
// Update number of friends who are abstainers, light/moderate drinkers, and heavy drinkers
for (int i=0; i<agentList.size(); i++) {
int numNoDrk = 0, numLightDrk = 0, numHeavyDrk = 0;
AlcoholAgent a = (AlcoholAgent)agentList.get(i);
for (int w=0; w<a.getTotalFriends(); w++) {
if (a.friendList.get(w).getDrinkStat()==1) { numNoDrk += 1; }
else if (a.friendList.get(w).getDrinkStat()==2) { numLightDrk += 1; }
else if (a.friendList.get(w).getDrinkStat()==3) { numHeavyDrk += 1; }
}
a.setNumFrdNoDrk(numNoDrk);
a.setNumFrdLightDrk(numLightDrk);
a.setNumFrdHeavyDrk(numHeavyDrk);
}
// 11 - Identify potential victims and perpetrators of violence, including homicide
for (int i=0; i<agentList.size(); i++) {
AlcoholAgent a = (AlcoholAgent)agentList.get(i);
AlcoholNeighborhood nb = (AlcoholNeighborhood)hoodList.get(a.Agenthood);
// Remember average level of violence and income in neighborhood at last time step
nb.setLastavghoodviol(nb.getAvghoodviol());
nb.setLastavghoodinc(nb.getAvghoodinc());
// 12a - Calculate probabilities of homicide
double logitPhom, ihomP1, ihomP2, ihomP3, ihomP4, logNhom, nhomP, homP;
// Homicide
// INFLUENCE OF INDIVIDUAL LEVEL
// 12.5.2014 -- calibration: increase intercept from -12.8404 to -10.5, back to -12.25
// increase Inc1 coefficient from 2.1891 to 3.35, increase Age1 coefficient from 1.6775 to 2.5
// logitPhom = (double) -12.25 + (3.35*a.getInc1()) + (1.3085*a.getInc2()) + (-0.0753*a.getInc3()) +
// (1.8814*a.getGender()) + (2.5*a.getAge1()) + (1.3167*a.getAge2()) + (0.8021*a.getAge3()) +
// (0.6588*a.getAge4()) + (0.2296*a.getAge5());
// calibration: decrease intercept from -15.35 to -16.75
// 12.21.2015 -- calibration: trying equation above.
// 12.28.2015 -- note: equation above is bad, switching back.
// 12.28.2015 -- calibration: decrease intercept from -16.75 to -18.00
// 12.30.2015 -- calibration: decrease intercept from -18.00 to -22.00
// 1.4.2015 -- calibration: decrease intercept from -22 to -30
// 1.5.2015 -- calibration: decrease intercept from -30 to -40
// 1.6.2016 -- calibration: increase intercept from -40 to -35
// 1.7.2016 -- calibration: increase intercept from -35 to -30
// 1.11.2016 -- calibration: increase intercept from -30 to -15
logitPhom = (double) -15.00 + (4.95*a.getInc1()) + (3.15*a.getInc2()) + (0.10*a.getInc3()) +
(1.8814*a.getGender()) + (3.0*a.getAge1()) + (1.3167*a.getAge2()) + (0.8021*a.getAge3()) +
(0.6588*a.getAge4()) + (0.2296*a.getAge5());
ihomP1 = Math.exp(logitPhom)/(1 + Math.exp(logitPhom));
// increase probability of homicide if history of violence and/or heavy drinker
// and decrease probability of homicide if no history of violence and/or not heavy drinker
// 3.12.15 -- 50% increase for prior violence instead of 25%
// 100% increase for heavy drinker instead of 20%
if (a.getPriorviolvict()==1 || a.getPriorviolperp()==1) { ihomP2 = ihomP1*1.50; } else { ihomP2 = ihomP1*0.75; }
if (a.getHeavyDrinker()==1) { ihomP3 = ihomP2*2.0; } else { ihomP3 = ihomP2*0.80; }
// INFLUENCE OF NEIGHBORHOOD LEVEL
// neighborhood influences begin after burn-in period
// 12.5.2014 -- calibration: increase intercept from -11.0397 to -10.0
// increase PercBlack coefficient from 2.2516 to 3.15 to 3.50
// 1.22.2015 -- calibration: add percent foreign-born and percent man/prof occupations
if (getTickCount()>startAging) {
// logNhom = (double) -10.4195 + (0.7292*nb.getHoodinc1()) + (0.6135*nb.getHoodinc2()) +
// (0.3409*nb.getAvghoodviol()) + (-0.1699*nb.getPercLightDrk()) +
// (-0.182*nb.getPercHeavyDrk()) + (2.045*nb.getPercBlack()) +
// (1.3021*nb.getPercHisp()) + (-0.0125*nb.getPercFBorn()) +
// (-0.0185*nb.getPercManProf());
// 3.12.15 -- calibration: increase hoodinc1 coefficient from 1.80 to 2.20
// increase hoodinc2 coefficient from 0.70 to 0.85
// increase avghoodviol coefficient from 0.90 to 1.25
// logNhom = (double) -9.75 + (2.20*nb.getHoodinc1()) + (0.85*nb.getHoodinc2()) +
// (1.25*nb.getAvghoodviol()) + (-0.10*nb.getPercLightDrk()) +
// (-0.12*nb.getPercHeavyDrk()) + (5.15*nb.getPercBlack()) +
// (3.0*nb.getPercHisp()) + (-0.025*nb.getPercFBorn()) +
// (-0.03*nb.getPercManProf());
// 3.12.15 -- calibration: increase intercept from -12.461 to -11.0
// increase hoodinc1 coefficient from 0.3880 to 2.50
// increase hoodinc2 coefficient from 0.5214 to 0.85
// increase avghoodviol coefficient from 0.0294 to 1.25
// increase percblack coefficient from 1.3834 to 5.75
// increase perchisp coefficient from 0.1293 to 2.75
// decrease percmanprof coefficient from 0.0101 to -0.005
// decrease percstable coefficient from 1.2459 to 0.01
// increase percunemp from 1.4887 to 2.20
// 3.22.15 -- calibration: decrease intercept form -11.0 to -11.15
// decrease percblack coefficient from 5.75 to 5.30
// decrease percyoungmale coefficient from 8.4289 to 8.10
// 1.5.16 -- decrease percblack coefficient from 5.30 to 3.00
logNhom = (double) -11.15 + (2.50*nb.getHoodinc1()) + (0.85*nb.getHoodinc2()) +
(1.25*nb.getAvghoodviol()) + (-0.0834*nb.getPercLightDrk()) +
(-0.044*nb.getPercHeavyDrk()) + (3.00*nb.getPercBlack()) +
(2.75*nb.getPercHisp()) + (-0.007*nb.getPercFBorn()) +
(-0.005*nb.getPercManProf()) + (8.10*nb.getPercYoungMale()) +
(0.01*nb.getPercStable()) + (2.20*nb.getPercUnemp()) +
(3.9179*nb.getPercFemHHKids());
nhomP = Math.exp(logNhom);
} else nhomP = ihomP3;
// FINAL PROBABILITIY
if (getTickCount()>startAging) { homP = ((1 - getNetwork_alpha() - getAlpha())*(ihomP3)) + (getAlpha()*nhomP); }
else { homP = ((1 - getNetwork_alpha())*ihomP3); }
a.setProbHomicide(homP);
// 12b - Calculate probabilities of violent victimization
double logitP1, logitP2;
double iviolP1, iviolP2, iviolP3, iviolP4; // individual-level probabilities
double logitN1, logitN2;
double nviolP1, nviolP2; // neighborhood-level probabilities
double violP1, violP2;
// Non-fatal violent victimization
// INFLUENCE OF INDIVIDUAL LEVEL
// 11.20.2014 -- revised equation to change reference groups
// calibration: decrease intercept from -3.8974 to -5.50
// increase Lesshs coefficient from 0.8145 to 1.45
// increase HS coefficient from -0.7195 to 0.90
// increase Inc1 coefficient from 0.2534 to 1.75
// increase Inc2 coefficient from 0.20 to 0.55
// increase Age1 coefficient from 1.7068 to 2.2
// calibration: decrease intercept from -5.80 to -6.75
// 12.21.15 -- increase intercept from -6.75 to -5.80
// 12.30.15 -- increase intercept from -5.80 to -5.00
// 1.4.16 -- decrease intercept from -5.00 to -5.50
// 1.5.16 -- decrease intercept from -5.50 to -5.75
// 1.6.16 -- increase intercept from -5.75 to -5.65
// 1.7.16 -- decrease intercept from -5.65 to -5.70
logitP1 = (double) -5.70 + (0.2796*a.getGender()) + (2.2*a.getAge1()) +
(0.85*a.getAge2()) + (0.5763*a.getAge3()) + (0.0143*a.getAge4()) +
(-0.17*a.getAge5()) + (1.45*a.getLesshs()) + (0.90*a.getHs()) +
(1.75*a.getInc1()) + (0.55*a.getInc2()) + (0.128*a.getInc3()) +
(-0.6113*a.getLightDrinker()) + (0.6341*a.getHeavyDrinker()) +
(1.614*a.getPriorviolvict()) + (0.4095*a.getPriorviolperp());
iviolP1 = Math.exp(logitP1)/(1 + Math.exp(logitP1));
// INFLUENCE OF NEIGHBORHOOD LEVEL
// neighborhood influences begin after burn-in period
// 11.19.2014 -- calibration: increase intercept from -3.6763 to -3.00
// 12.4.2014 -- calibration: increase percblack coefficient from -0.5331 to 2.50
// increase perchisp coefficient from -1.5628 to 0.30
if (getTickCount()>startAging) {
// logitN1 = (double) -3.00 + (0.3995*nb.getHoodinc1()) + (0.0248*nb.getHoodinc2()) +
// (2.50*nb.getPercBlack()) + (0.30*nb.getPercHisp()) +
// (14.7472*nb.getAvghoodviol());
// 3.12.2015 -- calibration: decrease intercept from 1.7728 to 0.25 to -2.20
// increase hoodinc1 coefficient from 0.6044 to 3.5
// increase hoodinc2 coefficient from 0.0777 to 1.5
// increase percblack coefficient from 0.0053 to 6.75
// increase perchisp coefficient from -1.3231 to 2.50
// decrease percyoungmale coefficient from 23.1486 to 10.0
// increase percstable coefficient from -7.6444 to -0.50
// increase unemp coefficient from -9.0505 to 5.0
// increase femhhkids coefficient from 0.3383 to 4.50
// 12.30.2015 increase percblack coefficient from 6.75 to 7.25
// 1.5.2016 increase percblack coefficient from 7.25 to 8.50
// 1.6.2016 increase percblack coefficient from 8.50 to 10.00
// 1.7.2016 increase percblack coefficient from 10.00 to 12.00
// 1.11.2016 increase percblack coefficient from 12 to 20
logitN1 = (double) -2.20 + (3.5*nb.getHoodinc1()) + (1.5*nb.getHoodinc2()) +
(20.00*nb.getPercBlack()) + (2.5*nb.getPercHisp()) +
(16.4594*nb.getAvghoodviol()) + (10.0*nb.getPercYoungMale()) +
(-0.50*nb.getPercStable()) + (5.00*nb.getPercUnemp()) +
(4.50*nb.getPercFemHHKids());
nviolP1 = Math.exp(logitN1)/(1 + Math.exp(logitN1));
} else nviolP1 = 0;
// FINAL PROBABILITY
if (getTickCount()>startAging) { violP1 = ((1 - getAlpha() - getNetwork_alpha())*(iviolP1)) + (getAlpha()*nviolP1); }
else { violP1 = ((1 - getNetwork_alpha())*iviolP1); }
a.setPviolvict(violP1);
// 12c - Calculate probability of violent perpetration
// INFLUENCE OF INDIVIDUAL LEVEL
// 11.20.2014 -- revised equation to change reference categories
// calibration: decrease intercept from -6.2805 to -6.75 to -7.50
// increase coefficient for Age2 from 0.0985 to 1.25
// increase coefficient for Age3 from -0.3876 to 0.15
// increase coefficient for Lesshs from 0.3332 to 0.90 to 1.00
// increase coefficient for HS from 0.2902 to 0.65
// increase coefficient for Inc1 from -0.1394 to 0.75 to 0.95
// increase coefficient for Inc2 from -0.3918 to 0.40 to 0.55
// increase coefficient for Inc3 from -0.3904 to 0.125
// increase coefficient for priorviolperp from 1.0548 to 1.25
// 12.21.2015 increase intercept from -8.50 to -7.50
// 1.5.2016 decrease intercept from -7.50 to -7.60
// 1.6.2016 decrease intercept from -7.60 to -7.70
// 1.7.2016 decrease intercept from -7.70 to -7.80
// 1.11.2016 decrease intercept from -7.80 to 8.00
//
logitP2 = (double) -8.00 + (1.0901*a.getGender()) + (1.1434*a.getAge1()) +
(1.25*a.getAge2()) + (0.15*a.getAge3()) + (-0.9339*a.getAge4()) +
(-2.3138*a.getAge5()) + (1.00*a.getLesshs()) + (0.65*a.getHs()) +
(0.95*a.getInc1()) + (0.55*a.getInc2()) + (0.125*a.getInc3()) +
(0.0072*a.getLightDrinker()) + (0.4521*a.getHeavyDrinker()) +
(2.1887*a.getPriorviolvict()) + (1.25*a.getPriorviolperp());
iviolP3 = Math.exp(logitP2)/(1 + Math.exp(logitP2));
// INFLUENCE OF NEIGHBORHOOD LEVEL
// neighborhood influences begin after burn-in period
// 11.19.2014 -- calibration: increase intercept from -4.9017 to -3.75
// 12.4.2014 -- calibration: increase percblack coefficient from -0.5331 to 2.50
// increase perchisp coefficient from -1.5628 to 0.30
// 12.28.2015 -- calibration: increase percblack coefficient from 6.75 to 7.00
// 1.4.2016 -- calibration: increase percblack coefficient from 7.00 to 8.00
// 1.5.2016 -- calibration: increase percblack coefficient from 8.00 to 10.00