-
Notifications
You must be signed in to change notification settings - Fork 0
/
P6.Draw-graphs1.nls
2116 lines (1993 loc) · 87.6 KB
/
P6.Draw-graphs1.nls
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
To P6.Draw-graphs
P61.Subsidy-policy
P62.Gender&Labour-policies
End
;---------------To Draw-Population-Household-Unit------------
To P41.Draw-household-clustering
let total count turtles with [PH_ID > 0]
let hclus1 count turtles with [hclus = 1]
let hclus2 count turtles with [hclus = 2]
let hclus3 count turtles with [hclus = 3]
set-current-plot "Population clustering"
;set-current-plot-pen "Total population"
;plot total
set-current-plot-pen "cluster1" plot hclus1
set-current-plot-pen "cluster2" plot hclus2
set-current-plot-pen "cluster3" plot hclus3
End
;---productivity---------------------------------------------------
;--------------Draw nutrient balance-------------------------------
To P61.Subsidy-policy
P611.Productivity
P612.Ecological
P613.Economic
P614.Social
end
To P611.Productivity
P6111.Fertilizer-input ;IN1
P6112.Organic-manure-input ;IN2
P6113.Maize-yield ;OUT1
P6114.Legume-yield ;OUT1
End
To P6111.Fertilizer-input
;fertilizer input for whole population
let Fs0a mean [F-S0] of turtles
let Fs0-sd standard-deviation [F-s0] of turtles
let Fs0-se Fs0-sd / sqrt (count turtles )
let Fs0-ci Fs0-se * 1.96
let Fs0Al Fs0a - Fs0-ci
let Fs0Au Fs0a + Fs0-ci
let Fs1a mean [F-S1] of turtles
let Fs1-sd standard-deviation [F-s1] of turtles
let Fs1-se Fs1-sd / sqrt (count turtles )
let Fs1-ci Fs1-se * 1.96
let Fs1Al Fs1a - Fs1-ci
let Fs1Au Fs1a + Fs1-ci
let Fs2A mean [F-S2] of turtles
let Fs2-sd standard-deviation [F-s2] of turtles
let Fs2-se Fs2-sd / sqrt (count turtles )
let Fs2-ci Fs2-se * 1.96
let Fs2Al Fs2a - Fs2-ci
let Fs2Au Fs2a + Fs2-ci
let Fs3A mean [F-S3] of turtles
let Fs3-sd standard-deviation [F-s3] of turtles
let Fs3-se Fs3-sd / sqrt (count turtles )
let Fs3-ci Fs3-se * 1.96
let Fs3Al Fs3a - Fs3-ci
let Fs3Au Fs3a + Fs3-ci
set-current-plot "fert (fert-subsidy) population"
set-current-plot-pen "F_zero-sub" plot Fs0a
set-current-plot-pen "Fs0l" plot Fs0Al
set-current-plot-pen "Fs0u" plot Fs0Au
set-current-plot-pen "F_current-sub" plot Fs1a
set-current-plot-pen "Fs1l" plot Fs1Al
set-current-plot-pen "Fs1u" plot Fs1Au
set-current-plot-pen "F_reduced-sub" plot Fs2a
set-current-plot-pen "Fs2l" plot Fs2Al
set-current-plot-pen "Fs2u" plot Fs2Au
set-current-plot-pen "F_universal-sub" plot Fs3a
set-current-plot-pen "Fs3l" plot Fs3Al
set-current-plot-pen "Fs3u" plot Fs3Au
; fertilizer input for cluster 1
let Fs0c1 mean [F-hc-s0] of turtles with [ hclus = 1]
let Fs0c1-sd standard-deviation [F-hc-s0] of turtles with [ hclus = 1]
let Fs0c1-se Fs0c1-sd / sqrt (count turtles with [ hclus = 1])
let Fs0c1-ci Fs0c1-se * 1.96
let Fs0c1l Fs0c1 - Fs0c1-ci
let Fs0c1u Fs0c1 + Fs0c1-ci
let Fs1c1 mean [F-hc-s1] of turtles with [ hclus = 1]
let Fs1c1-sd standard-deviation [F-hc-s1] of turtles with [ hclus = 1]
let Fs1c1-se Fs1c1-sd / sqrt (count turtles with [ hclus = 1])
let Fs1c1-ci Fs1c1-se * 1.96
let Fs1c1l Fs1c1 - Fs1c1-ci
let Fs1c1u Fs1c1 + Fs1c1-ci
let Fs2c1 mean [F-hc-s2] of turtles with [ hclus = 1]
let Fs2c1-sd standard-deviation [F-hc-s2] of turtles with [ hclus = 1]
let Fs2c1-se Fs2c1-sd / sqrt (count turtles with [ hclus = 1])
let Fs2c1-ci Fs2c1-se * 1.96
let Fs2c1l Fs2c1 - Fs2c1-ci
let Fs2c1u Fs2c1 + Fs2c1-ci
let Fs3c1 mean [F-hc-s3] of turtles with [ hclus = 1]
let Fs3c1-sd standard-deviation [F-hc-s3] of turtles with [ hclus = 1]
let Fs3c1-se Fs3c1-sd / sqrt (count turtles with [ hclus = 1])
let Fs3c1-ci Fs3c1-se * 1.96
let Fs3c1l Fs3c1 - Fs3c1-ci
let Fs3c1u Fs3c1 + Fs3c1-ci
set-current-plot "fert (fert-subsidy) farmtype1"
set-current-plot-pen "Fs0-c1" plot Fs0c1
set-current-plot-pen "Fs0-c1l" plot Fs0c1l
set-current-plot-pen "Fs0-c1u" plot Fs0c1u
set-current-plot-pen "Fs1-c1" plot Fs1c1
set-current-plot-pen "Fs1-c1l" plot Fs1c1l
set-current-plot-pen "Fs1-c1u" plot Fs1c1u
set-current-plot-pen "Fs2-c1" plot Fs2c1
set-current-plot-pen "Fs2-c1l" plot Fs2c1l
set-current-plot-pen "Fs2-c1u" plot Fs2c1u
set-current-plot-pen "Fs3-c1" plot Fs3c1
set-current-plot-pen "Fs3-c1l" plot Fs3c1l
set-current-plot-pen "Fs3-c1u" plot Fs3c1u
; fertilizer input for by cluster 2
let Fs0c2 mean [F-hc-s0] of turtles with [ hclus = 2]
let Fs0c2-sd standard-deviation [F-hc-s0] of turtles with [ hclus = 2]
let Fs0c2-se Fs0c2-sd / sqrt (count turtles with [ hclus = 2])
let Fs0c2-ci Fs0c2-se * 1.96
let Fs0c2l Fs0c2 - Fs0c2-ci
let Fs0c2u Fs0c2 + Fs0c2-ci
let Fs1c2 mean [F-hc-s1] of turtles with [ hclus = 2]
let Fs1c2-sd standard-deviation [F-hc-s1] of turtles with [ hclus = 2]
let Fs1c2-se Fs1c2-sd / sqrt (count turtles with [ hclus = 2])
let Fs1c2-ci Fs1c2-se * 1.96
let Fs1c2l Fs1c2 - Fs1c2-ci
let Fs1c2u Fs1c2 + Fs1c2-ci
let Fs2c2 mean [F-hc-s2] of turtles with [ hclus = 2]
let Fs2c2-sd standard-deviation [F-hc-s2] of turtles with [ hclus = 2]
let Fs2c2-se Fs2c2-sd / sqrt (count turtles with [ hclus = 2])
let Fs2c2-ci Fs2c2-se * 1.96
let Fs2c2l Fs2c2 - Fs2c2-ci
let Fs2c2u Fs2c2 + Fs2c2-ci
let Fs3c2 mean [F-hc-s3] of turtles with [ hclus = 2]
let Fs3c2-sd standard-deviation [F-hc-s3] of turtles with [ hclus = 2]
let Fs3c2-se Fs3c2-sd / sqrt (count turtles with [ hclus = 2])
let Fs3c2-ci Fs3c2-se * 1.96
let Fs3c2l Fs3c2 - Fs3c2-ci
let Fs3c2u Fs3c2 + Fs3c2-ci
set-current-plot "fert (fert-subsidy) farmtype2"
set-current-plot-pen "Fs0-c2" plot Fs0c2
set-current-plot-pen "Fs0-c2l" plot Fs0c2l
set-current-plot-pen "Fs0-c2u" plot Fs0c2u
set-current-plot-pen "Fs1-c2" plot Fs1c2
set-current-plot-pen "Fs1-c2l" plot Fs1c2l
set-current-plot-pen "Fs1-c2u" plot Fs1c2u
set-current-plot-pen "Fs2-c2" plot Fs2c2
set-current-plot-pen "Fs2-c2l" plot Fs2c2l
set-current-plot-pen "Fs2-c2u" plot Fs2c2u
set-current-plot-pen "Fs3-c2" plot Fs3c2
set-current-plot-pen "Fs3-c2l" plot Fs3c2l
set-current-plot-pen "Fs3-c2u" plot Fs3c2u
; fertilizer input for cluster 3
let Fs0c3 mean [F-hc-s0] of turtles with [ hclus = 3]
let Fs0c3-sd standard-deviation [F-hc-s0] of turtles with [ hclus = 3]
let Fs0c3-se Fs0c3-sd / sqrt (count turtles with [ hclus = 3])
let Fs0c3-ci Fs0c3-se * 1.96
let Fs0c3l Fs0c3 - Fs0c3-ci
let Fs0c3u Fs0c3 + Fs0c3-ci
let Fs1c3 mean [F-hc-s1] of turtles with [ hclus = 3]
let Fs1c3-sd standard-deviation [F-hc-s1] of turtles with [ hclus = 3]
let Fs1c3-se Fs1c3-sd / sqrt (count turtles with [ hclus = 3])
let Fs1c3-ci Fs1c3-se * 1.96
let Fs1c3l Fs1c3 - Fs1c3-ci
let Fs1c3u Fs1c3 + Fs1c3-ci
let Fs2c3 mean [F-hc-s2] of turtles with [ hclus = 3]
let Fs2c3-sd standard-deviation [F-hc-s2] of turtles with [ hclus = 3]
let Fs2c3-se Fs2c3-sd / sqrt (count turtles with [ hclus = 3])
let Fs2c3-ci Fs2c3-se * 1.96
let Fs2c3l Fs2c3 - Fs2c3-ci
let Fs2c3u Fs2c3 + Fs2c3-ci
let Fs3c3 mean [F-hc-s3] of turtles with [ hclus = 3]
let Fs3c3-sd standard-deviation [F-hc-s3] of turtles with [ hclus = 3]
let Fs3c3-se Fs3c3-sd / sqrt (count turtles with [ hclus = 3])
let Fs3c3-ci Fs3c3-se * 1.96
let Fs3c3l Fs3c3 - Fs3c3-ci
let Fs3c3u Fs3c3 + Fs3c3-ci
set-current-plot "fert (fert-subsidy) farmtype3"
set-current-plot-pen "Fs0-c3" plot Fs0c3
set-current-plot-pen "Fs0-c3l" plot Fs0c3l
set-current-plot-pen "Fs0-c3u" plot Fs0c3u
set-current-plot-pen "Fs1-c3" plot Fs1c3
set-current-plot-pen "Fs1-c3l" plot Fs1c3l
set-current-plot-pen "Fs1-c3u" plot Fs1c3u
set-current-plot-pen "Fs2-c3" plot Fs2c3
set-current-plot-pen "Fs2-c3l" plot Fs2c3l
set-current-plot-pen "Fs2-c3u" plot Fs2c3u
set-current-plot-pen "Fs3-c3" plot Fs3c3
set-current-plot-pen "Fs3-c3l" plot Fs3c3l
set-current-plot-pen "Fs3-c3u" plot Fs3c3u
End
To P6112.Organic-manure-input
;Manure input whole population
let os0a mean [o-s0] of turtles
let os0-sd standard-deviation [o-s0] of turtles
let os0-se os0-sd / sqrt (count turtles )
let os0-ci os0-se * 1.96
let os0Al os0a - os0-ci
let os0Au os0a + os0-ci
let os1a mean [o-s1] of turtles
let os1-sd standard-deviation [o-s1] of turtles
let os1-se os1-sd / sqrt (count turtles )
let os1-ci os1-se * 1.96
let os1Al os1a - os1-ci
let os1Au os1a + os1-ci
let os2A mean [o-s2] of turtles
let os2-sd standard-deviation [o-s2] of turtles
let os2-se os2-sd / sqrt (count turtles )
let os2-ci os2-se * 1.96
let os2Al os2a - os2-ci
let os2Au os2a + os2-ci
let os3A mean [o-s3] of turtles
let os3-sd standard-deviation [o-s3] of turtles
let os3-se os3-sd / sqrt (count turtles )
let os3-ci os3-se * 1.96
let os3Al os3a - os3-ci
let os3Au os3a + os3-ci
set-current-plot "OM (fert-subsidy) population"
set-current-plot-pen "O_zero-sub" plot os0a
set-current-plot-pen "os0l" plot os0Al
set-current-plot-pen "os0u" plot os0Au
set-current-plot-pen "O_current-sub" plot os1a
set-current-plot-pen "os1l" plot os1Al
set-current-plot-pen "os1u" plot os1Au
set-current-plot-pen "O_reduced-sub" plot os2a
set-current-plot-pen "os2l" plot os2Al
set-current-plot-pen "os2u" plot os2Au
set-current-plot-pen "O_universal-sub" plot os3a
set-current-plot-pen "os3l" plot os3Al
set-current-plot-pen "os3u" plot os3Au
; Manure application by cluster 1
let os0c1 mean [o-hc-s0] of turtles with [ hclus = 1]
let os0c1-sd standard-deviation [o-hc-s0] of turtles with [ hclus = 1]
let os0c1-se os0c1-sd / sqrt (count turtles with [ hclus = 1])
let os0c1-ci os0c1-se * 1.96
let os0c1l os0c1 - os0c1-ci
let os0c1u os0c1 + os0c1-ci
let os1c1 mean [o-hc-s1] of turtles with [ hclus = 1]
let os1c1-sd standard-deviation [o-hc-s1] of turtles with [ hclus = 1]
let os1c1-se os1c1-sd / sqrt (count turtles with [ hclus = 1])
let os1c1-ci os1c1-se * 1.96
let os1c1l os1c1 - os1c1-ci
let os1c1u os1c1 + os1c1-ci
let os2c1 mean [o-hc-s2] of turtles with [ hclus = 1]
let os2c1-sd standard-deviation [o-hc-s2] of turtles with [ hclus = 1]
let os2c1-se os2c1-sd / sqrt (count turtles with [ hclus = 1])
let os2c1-ci os2c1-se * 1.96
let os2c1l os2c1 - os2c1-ci
let os2c1u os2c1 + os2c1-ci
let os3c1 mean [o-hc-s3] of turtles with [ hclus = 1]
let os3c1-sd standard-deviation [o-hc-s3] of turtles with [ hclus = 1]
let os3c1-se os3c1-sd / sqrt (count turtles with [ hclus = 1])
let os3c1-ci os3c1-se * 1.96
let os3c1l os3c1 - os3c1-ci
let os3c1u os3c1 + os3c1-ci
set-current-plot "OM (fert-subsidy) farmtype1"
set-current-plot-pen "os0-c1" plot os0c1
set-current-plot-pen "os0-c1l" plot os0c1l
set-current-plot-pen "os0-c1u" plot os0c1u
set-current-plot-pen "os1-c1" plot os1c1
set-current-plot-pen "os1-c1l" plot os1c1l
set-current-plot-pen "os1-c1u" plot os1c1u
set-current-plot-pen "os2-c1" plot os2c1
set-current-plot-pen "os2-c1l" plot os2c1l
set-current-plot-pen "os2-c1u" plot os2c1u
set-current-plot-pen "os3-c1" plot os3c1
set-current-plot-pen "os3-c1l" plot os3c1l
set-current-plot-pen "os3-c1u" plot os3c1u
; Manure application by cluster 2
let os0c2 mean [o-hc-s0] of turtles with [ hclus = 2]
let os0c2-sd standard-deviation [o-hc-s0] of turtles with [ hclus = 2]
let os0c2-se os0c2-sd / sqrt (count turtles with [ hclus = 2])
let os0c2-ci os0c2-se * 1.96
let os0c2l os0c2 - os0c2-ci
let os0c2u os0c2 + os0c2-ci
let os1c2 mean [o-hc-s1] of turtles with [ hclus = 2]
let os1c2-sd standard-deviation [o-hc-s1] of turtles with [ hclus = 2]
let os1c2-se os1c2-sd / sqrt (count turtles with [ hclus = 2])
let os1c2-ci os1c2-se * 1.96
let os1c2l os1c2 - os1c2-ci
let os1c2u os1c2 + os1c2-ci
let os2c2 mean [o-hc-s2] of turtles with [ hclus = 2]
let os2c2-sd standard-deviation [o-hc-s2] of turtles with [ hclus = 2]
let os2c2-se os2c2-sd / sqrt (count turtles with [ hclus = 2])
let os2c2-ci os2c2-se * 1.96
let os2c2l os2c2 - os2c2-ci
let os2c2u os2c2 + os2c2-ci
let os3c2 mean [o-hc-s3] of turtles with [ hclus = 2]
let os3c2-sd standard-deviation [o-hc-s3] of turtles with [ hclus = 2]
let os3c2-se os3c2-sd / sqrt (count turtles with [ hclus = 2])
let os3c2-ci os3c2-se * 1.96
let os3c2l os3c2 - os3c2-ci
let os3c2u os3c2 + os3c2-ci
set-current-plot "OM (fert-subsidy) farmtype2"
set-current-plot-pen "os0-c2" plot os0c2
set-current-plot-pen "os0-c2l" plot os0c2l
set-current-plot-pen "os0-c2u" plot os0c2u
set-current-plot-pen "os1-c2" plot os1c2
set-current-plot-pen "os1-c2l" plot os1c2l
set-current-plot-pen "os1-c2u" plot os1c2u
set-current-plot-pen "os2-c2" plot os2c2
set-current-plot-pen "os2-c2l" plot os2c2l
set-current-plot-pen "os2-c2u" plot os2c2u
set-current-plot-pen "os3-c2" plot os3c2
set-current-plot-pen "os3-c2l" plot os3c2l
set-current-plot-pen "os3-c2u" plot os3c2u
; Manure application by cluster 3
let os0c3 mean [o-hc-s0] of turtles with [ hclus = 3]
let os0c3-sd standard-deviation [o-hc-s0] of turtles with [ hclus = 3]
let os0c3-se os0c3-sd / sqrt (count turtles with [ hclus = 3])
let os0c3-ci os0c3-se * 1.96
let os0c3l os0c3 - os0c3-ci
let os0c3u os0c3 + os0c3-ci
let os1c3 mean [o-hc-s1] of turtles with [ hclus = 3]
let os1c3-sd standard-deviation [o-hc-s1] of turtles with [ hclus = 3]
let os1c3-se os1c3-sd / sqrt (count turtles with [ hclus = 3])
let os1c3-ci os1c3-se * 1.96
let os1c3l os1c3 - os1c3-ci
let os1c3u os1c3 + os1c3-ci
let os2c3 mean [o-hc-s2] of turtles with [ hclus = 3]
let os2c3-sd standard-deviation [o-hc-s2] of turtles with [ hclus = 3]
let os2c3-se os2c3-sd / sqrt (count turtles with [ hclus = 3])
let os2c3-ci os2c3-se * 1.96
let os2c3l os2c3 - os2c3-ci
let os2c3u os2c3 + os2c3-ci
let os3c3 mean [o-hc-s3] of turtles with [ hclus = 3]
let os3c3-sd standard-deviation [o-hc-s3] of turtles with [ hclus = 3]
let os3c3-se os3c3-sd / sqrt (count turtles with [ hclus = 3])
let os3c3-ci os3c3-se * 1.96
let os3c3l os3c3 - os3c3-ci
let os3c3u os3c3 + os3c3-ci
set-current-plot "OM (fert-subsidy) farmtype3"
set-current-plot-pen "os0-c3" plot os0c3
set-current-plot-pen "os0-c3l" plot os0c3l
set-current-plot-pen "os0-c3u" plot os0c3u
set-current-plot-pen "os1-c3" plot os1c3
set-current-plot-pen "os1-c3l" plot os1c3l
set-current-plot-pen "os1-c3u" plot os1c3u
set-current-plot-pen "os2-c3" plot os2c3
set-current-plot-pen "os2-c3l" plot os2c3l
set-current-plot-pen "os2-c3u" plot os2c3u
set-current-plot-pen "os3-c3" plot os3c3
set-current-plot-pen "os3-c3l" plot os3c3l
set-current-plot-pen "os3-c3u" plot os3c3u
End
To P6113.Maize-yield
;Manure input whole population
let ms0a mean [m-s0] of turtles with [m-s0 > 0]
let ms0-sd standard-deviation [m-s0] of turtles with [m-s0 > 0]
let ms0-se ms0-sd / sqrt (count turtles with [m-s0 > 0])
let ms0-ci ms0-se * 1.96
let ms0Al ms0a - ms0-ci
let ms0Au ms0a + ms0-ci
let ms1a mean [m-s1] of turtles with [m-s1 > 0]
let ms1-sd standard-deviation [m-s1] of turtles with [m-s1 > 0]
let ms1-se ms1-sd / sqrt (count turtles with [m-s1 > 0])
let ms1-ci ms1-se * 1.96
let ms1Al ms1a - ms1-ci
let ms1Au ms1a + ms1-ci
let ms2A mean [m-s2] of turtles with [m-s2 > 0]
let ms2-sd standard-deviation [m-s2] of turtles with [m-s2 > 0]
let ms2-se ms2-sd / sqrt (count turtles with [m-s2 > 0])
let ms2-ci ms2-se * 1.96
let ms2Al ms2a - ms2-ci
let ms2Au ms2a + ms2-ci
let ms3A mean [m-s3] of turtles with [m-s3 > 0]
let ms3-sd standard-deviation [m-s3] of turtles with [m-s3 > 0]
let ms3-se ms3-sd / sqrt (count turtles with [m-s3 > 0])
let ms3-ci ms3-se * 1.96
let ms3Al ms3a - ms3-ci
let ms3Au ms3a + ms3-ci
set-current-plot "Maize (fert-subsidy) population"
set-current-plot-pen "M_zero-sub" plot ms0a
set-current-plot-pen "ms0l" plot ms0Al
set-current-plot-pen "ms0u" plot ms0Au
set-current-plot-pen "M_current-sub" plot ms1a
set-current-plot-pen "ms1l" plot ms1Al
set-current-plot-pen "ms1u" plot ms1Au
set-current-plot-pen "M_reduced-sub" plot ms2a
set-current-plot-pen "ms2l" plot ms2Al
set-current-plot-pen "ms2u" plot ms2Au
set-current-plot-pen "M_universal-sub" plot ms3a
set-current-plot-pen "ms3l" plot ms3Al
set-current-plot-pen "ms3u" plot ms3Au
; Manure application by cluster 1
let ms0c1 mean [m-hc-s0] of turtles with [m-hc-s0 > 0 and hclus = 1]
let ms0c1-sd standard-deviation [m-hc-s0] of turtles with [m-hc-s0 > 0 and hclus = 1]
let ms0c1-se ms0c1-sd / sqrt (count turtles with [m-hc-s0 > 0 and hclus = 1])
let ms0c1-ci ms0c1-se * 1.96
let ms0c1l ms0c1 - ms0c1-ci
let ms0c1u ms0c1 + ms0c1-ci
let ms1c1 mean [m-hc-s1] of turtles with [m-hc-s1 > 0 and hclus = 1]
let ms1c1-sd standard-deviation [m-hc-s1] of turtles with [m-hc-s1 > 0 and hclus = 1]
let ms1c1-se ms1c1-sd / sqrt (count turtles with [m-hc-s1 > 0 and hclus = 1])
let ms1c1-ci ms1c1-se * 1.96
let ms1c1l ms1c1 - ms1c1-ci
let ms1c1u ms1c1 + ms1c1-ci
let ms2c1 mean [m-hc-s2] of turtles with [m-hc-s2 > 0 and hclus = 1]
let ms2c1-sd standard-deviation [m-hc-s2] of turtles with [m-hc-s2 > 0 and hclus = 1]
let ms2c1-se ms2c1-sd / sqrt (count turtles with [m-hc-s2 > 0 and hclus = 1])
let ms2c1-ci ms2c1-se * 1.96
let ms2c1l ms2c1 - ms2c1-ci
let ms2c1u ms2c1 + ms2c1-ci
let ms3c1 mean [m-hc-s3] of turtles with [m-hc-s3 > 0 and hclus = 1]
let ms3c1-sd standard-deviation [m-hc-s3] of turtles with [m-hc-s3 > 0 and hclus = 1]
let ms3c1-se ms3c1-sd / sqrt (count turtles with [m-hc-s3 > 0 and hclus = 1])
let ms3c1-ci ms3c1-se * 1.96
let ms3c1l ms3c1 - ms3c1-ci
let ms3c1u ms3c1 + ms3c1-ci
set-current-plot "Maize (fert-subsidy) farmtype1"
set-current-plot-pen "ms0-c1" plot ms0c1
set-current-plot-pen "ms0-c1l" plot ms0c1l
set-current-plot-pen "ms0-c1u" plot ms0c1u
set-current-plot-pen "ms1-c1" plot ms1c1
set-current-plot-pen "ms1-c1l" plot ms1c1l
set-current-plot-pen "ms1-c1u" plot ms1c1u
set-current-plot-pen "ms2-c1" plot ms2c1
set-current-plot-pen "ms2-c1l" plot ms2c1l
set-current-plot-pen "ms2-c1u" plot ms2c1u
set-current-plot-pen "ms3-c1" plot ms3c1
set-current-plot-pen "ms3-c1l" plot ms3c1l
set-current-plot-pen "ms3-c1u" plot ms3c1u
; Manure application by cluster 1
let ms0c2 mean [m-hc-s0] of turtles with [m-hc-s0 > 0 and hclus = 2]
let ms0c2-sd standard-deviation [m-hc-s0] of turtles with [m-hc-s0 > 0 and hclus = 2]
let ms0c2-se ms0c2-sd / sqrt (count turtles with [m-hc-s0 > 0 and hclus = 2])
let ms0c2-ci ms0c2-se * 1.96
let ms0c2l ms0c2 - ms0c2-ci
let ms0c2u ms0c2 + ms0c2-ci
let ms1c2 mean [m-hc-s1] of turtles with [m-hc-s1 > 0 and hclus = 2]
let ms1c2-sd standard-deviation [m-hc-s1] of turtles with [m-hc-s1 > 0 and hclus = 2]
let ms1c2-se ms1c2-sd / sqrt (count turtles with [m-hc-s1 > 0 and hclus = 2])
let ms1c2-ci ms1c2-se * 1.96
let ms1c2l ms1c2 - ms1c2-ci
let ms1c2u ms1c2 + ms1c2-ci
let ms2c2 mean [m-hc-s2] of turtles with [m-hc-s2 > 0 and hclus = 2]
let ms2c2-sd standard-deviation [m-hc-s2] of turtles with [m-hc-s2 > 0 and hclus = 2]
let ms2c2-se ms2c2-sd / sqrt (count turtles with [m-hc-s2 > 0 and hclus = 2])
let ms2c2-ci ms2c2-se * 1.96
let ms2c2l ms2c2 - ms2c2-ci
let ms2c2u ms2c2 + ms2c2-ci
let ms3c2 mean [m-hc-s3] of turtles with [m-hc-s3 > 0 and hclus = 2]
let ms3c2-sd standard-deviation [m-hc-s3] of turtles with [m-hc-s3 > 0 and hclus = 2]
let ms3c2-se ms3c2-sd / sqrt (count turtles with [m-hc-s3 > 0 and hclus = 2])
let ms3c2-ci ms3c2-se * 1.96
let ms3c2l ms3c2 - ms3c2-ci
let ms3c2u ms3c2 + ms3c2-ci
set-current-plot "Maize (fert-subsidy) farmtype2"
set-current-plot-pen "ms0-c2" plot ms0c2
set-current-plot-pen "ms0-c2l" plot ms0c2l
set-current-plot-pen "ms0-c2u" plot ms0c2u
set-current-plot-pen "ms1-c2" plot ms1c2
set-current-plot-pen "ms1-c2l" plot ms1c2l
set-current-plot-pen "ms1-c2u" plot ms1c2u
set-current-plot-pen "ms2-c2" plot ms2c2
set-current-plot-pen "ms2-c2l" plot ms2c2l
set-current-plot-pen "ms2-c2u" plot ms2c2u
set-current-plot-pen "ms3-c2" plot ms3c2
set-current-plot-pen "ms3-c2l" plot ms3c2l
set-current-plot-pen "ms3-c2u" plot ms3c2u
; Manure application by cluster 3
let ms0c3 mean [m-hc-s0] of turtles with [m-hc-s0 > 0 and hclus = 3]
let ms0c3-sd standard-deviation [m-hc-s0] of turtles with [m-hc-s0 > 0 and hclus = 3]
let ms0c3-se ms0c3-sd / sqrt (count turtles with [m-hc-s0 > 0 and hclus = 3])
let ms0c3-ci ms0c3-se * 1.96
let ms0c3l ms0c3 - ms0c3-ci
let ms0c3u ms0c3 + ms0c3-ci
let ms1c3 mean [m-hc-s1] of turtles with [m-hc-s1 > 0 and hclus = 3]
let ms1c3-sd standard-deviation [m-hc-s1] of turtles with [m-hc-s1 > 0 and hclus = 3]
let ms1c3-se ms1c3-sd / sqrt (count turtles with [m-hc-s1 > 0 and hclus = 3])
let ms1c3-ci ms1c3-se * 1.96
let ms1c3l ms1c3 - ms1c3-ci
let ms1c3u ms1c3 + ms1c3-ci
let ms2c3 mean [m-hc-s2] of turtles with [m-hc-s2 > 0 and hclus = 3]
let ms2c3-sd standard-deviation [m-hc-s2] of turtles with [m-hc-s2 > 0 and hclus = 3]
let ms2c3-se ms2c3-sd / sqrt (count turtles with [m-hc-s2 > 0 and hclus = 3])
let ms2c3-ci ms2c3-se * 1.96
let ms2c3l ms2c3 - ms2c3-ci
let ms2c3u ms2c3 + ms2c3-ci
let ms3c3 mean [m-hc-s3] of turtles with [m-hc-s3 > 0 and hclus = 3]
let ms3c3-sd standard-deviation [m-hc-s3] of turtles with [m-hc-s3 > 0 and hclus = 3]
let ms3c3-se ms3c3-sd / sqrt (count turtles with [m-hc-s3 > 0 and hclus = 3])
let ms3c3-ci ms3c3-se * 1.96
let ms3c3l ms3c3 - ms3c3-ci
let ms3c3u ms3c3 + ms3c3-ci
set-current-plot "Maize (fert-subsidy) farmtype3"
set-current-plot-pen "ms0-c3" plot ms0c3
set-current-plot-pen "ms0-c3l" plot ms0c3l
set-current-plot-pen "ms0-c3u" plot ms0c3u
set-current-plot-pen "ms1-c3" plot ms1c3
set-current-plot-pen "ms1-c3l" plot ms1c3l
set-current-plot-pen "ms1-c3u" plot ms1c3u
set-current-plot-pen "ms2-c3" plot ms2c3
set-current-plot-pen "ms2-c3l" plot ms2c3l
set-current-plot-pen "ms2-c3u" plot ms2c3u
set-current-plot-pen "ms3-c3" plot ms3c3
set-current-plot-pen "ms3-c3l" plot ms3c3l
set-current-plot-pen "ms3-c3u" plot ms3c3u
End
To P6114.Legume-yield
;Legume yield whole population
let Ls0a mean [l-s0] of turtles with [l-s0 > 0]
let Ls0-sd standard-deviation [l-s0] of turtles with [l-s0 > 0]
let Ls0-se Ls0-sd / sqrt (count turtles with [l-s0 > 0])
let Ls0-ci Ls0-se * 1.96
let Ls0Al Ls0a - Ls0-ci
let Ls0Au Ls0a + Ls0-ci
let Ls1a mean [l-s1] of turtles with [l-s1 > 0]
let Ls1-sd standard-deviation [l-s1] of turtles with [l-s1 > 0]
let Ls1-se Ls1-sd / sqrt (count turtles with [l-s1 > 0])
let Ls1-ci Ls1-se * 1.96
let Ls1Al Ls1a - Ls1-ci
let Ls1Au Ls1a + Ls1-ci
let Ls2A mean [l-s2] of turtles with [l-s2 > 0]
let Ls2-sd standard-deviation [l-s2] of turtles with [l-s2 > 0]
let Ls2-se Ls2-sd / sqrt (count turtles with [l-s2 > 0])
let Ls2-ci Ls2-se * 1.96
let Ls2Al Ls2a - Ls2-ci
let Ls2Au Ls2a + Ls2-ci
let Ls3A mean [l-s3] of turtles with [l-s3 > 0]
let Ls3-sd standard-deviation [l-s3] of turtles with [l-s3 > 0]
let Ls3-se Ls3-sd / sqrt (count turtles with [l-s3 > 0])
let Ls3-ci Ls3-se * 1.96
let Ls3Al Ls3a - Ls3-ci
let Ls3Au Ls3a + Ls3-ci
set-current-plot "Legume (fert-subsidy) population"
set-current-plot-pen "L_zero-sub" plot Ls0a
set-current-plot-pen "Ls0l" plot Ls0Al
set-current-plot-pen "Ls0u" plot Ls0Au
set-current-plot-pen "L_current-sub" plot Ls1a
set-current-plot-pen "Ls1l" plot Ls1Al
set-current-plot-pen "Ls1u" plot Ls1Au
set-current-plot-pen "L_reduced-sub" plot Ls2a
set-current-plot-pen "Ls2l" plot Ls2Al
set-current-plot-pen "Ls2u" plot Ls2Au
set-current-plot-pen "L_universal-sub" plot Ls3a
set-current-plot-pen "Ls3l" plot Ls3Al
set-current-plot-pen "Ls3u" plot Ls3Au
End
To P612.Ecological
P6121.Nitrogen-balance
P6122.Phosphorus-balance
P6123.Potassium-balance
P6124.Carbon-balance
End
To P6121.Nitrogen-balance
;Nitrogen balance for whole population
let NBs0a mean [NB-S0] of turtles
let NBs0-sd standard-deviation [NB-s0] of turtles
let NBs0-se NBs0-sd / sqrt (count turtles)
let NBs0-ci NBs0-se * 1.96
let NBs0Al NBs0a - NBs0-ci
let NBs0Au NBs0a + NBs0-ci
let NBs1a mean [NB-S1] of turtles
let NBs1-sd standard-deviation [NB-s1] of turtles
let NBs1-se NBs1-sd / sqrt (count turtles)
let NBs1-ci NBs1-se * 1.96
let NBs1Al NBs1a - NBs1-ci
let NBs1Au NBs1a + NBs1-ci
let NBs2A mean [NB-S2] of turtles
let NBs2-sd standard-deviation [NB-s2] of turtles
let NBs2-se NBs2-sd / sqrt (count turtles )
let NBs2-ci NBs2-se * 1.96
let NBs2Al NBs2a - NBs2-ci
let NBs2Au NBs2a + NBs2-ci
let NBs3A mean [NB-S3] of turtles
let NBs3-sd standard-deviation [NB-s3] of turtles
let NBs3-se NBs3-sd / sqrt (count turtles)
let NBs3-ci NBs3-se * 1.96
let NBs3Al NBs3a - NBs3-ci
let NBs3Au NBs3a + NBs3-ci
set-current-plot "NB (fert-subsidy) population"
set-current-plot-pen "To-zero-sub" plot NBs0a
set-current-plot-pen "NBs0l" plot NBs0Al
set-current-plot-pen "NBs0u" plot NBs0Au
set-current-plot-pen "Current-sub" plot NBs1a
set-current-plot-pen "NBs1l" plot NBs1Al
set-current-plot-pen "NBs1u" plot NBs1Au
set-current-plot-pen "Reduced-sub" plot NBs2a
set-current-plot-pen "NBs2l" plot NBs2Al
set-current-plot-pen "NBs2u" plot NBs2Au
set-current-plot-pen "Universal-sub" plot NBs3a
set-current-plot-pen "NBs3l" plot NBs3Al
set-current-plot-pen "NBs3u" plot NBs3Au
; Nitrogen balance for cluster 1
let NBs0c1 mean [NB-hc-s0] of turtles with [ hclus = 1]
let NBs0c1-sd standard-deviation [NB-hc-s0] of turtles with [hclus = 1]
let NBs0c1-se NBs0c1-sd / sqrt (count turtles with [hclus = 1])
let NBs0c1-ci NBs0c1-se * 1.96
let NBs0c1l NBs0c1 - NBs0c1-ci
let NBs0c1u NBs0c1 + NBs0c1-ci
let NBs1c1 mean [NB-hc-s1] of turtles with [ hclus = 1]
let NBs1c1-sd standard-deviation [NB-hc-s1] of turtles with [hclus = 1]
let NBs1c1-se NBs1c1-sd / sqrt (count turtles with [hclus = 1])
let NBs1c1-ci NBs1c1-se * 1.96
let NBs1c1l NBs1c1 - NBs1c1-ci
let NBs1c1u NBs1c1 + NBs1c1-ci
let NBs2c1 mean [NB-hc-s2] of turtles with [hclus = 1]
let NBs2c1-sd standard-deviation [NB-hc-s2] of turtles with [hclus = 1]
let NBs2c1-se NBs2c1-sd / sqrt (count turtles with [hclus = 1])
let NBs2c1-ci NBs2c1-se * 1.96
let NBs2c1l NBs2c1 - NBs2c1-ci
let NBs2c1u NBs2c1 + NBs2c1-ci
let NBs3c1 mean [NB-hc-s3] of turtles with [hclus = 1]
let NBs3c1-sd standard-deviation [NB-hc-s3] of turtles with [hclus = 1]
let NBs3c1-se NBs3c1-sd / sqrt (count turtles with [hclus = 1])
let NBs3c1-ci NBs3c1-se * 1.96
let NBs3c1l NBs3c1 - NBs3c1-ci
let NBs3c1u NBs3c1 + NBs3c1-ci
set-current-plot "NB (fert-subsidy) farmtype1"
set-current-plot-pen "NBs0-c1" plot NBs0c1
set-current-plot-pen "NBs0-c1l" plot NBs0c1l
set-current-plot-pen "NBs0-c1u" plot NBs0c1u
set-current-plot-pen "NBs1-c1" plot NBs1c1
set-current-plot-pen "NBs1-c1l" plot NBs1c1l
set-current-plot-pen "NBs1-c1u" plot NBs1c1u
set-current-plot-pen "NBs2-c1" plot NBs2c1
set-current-plot-pen "NBs2-c1l" plot NBs2c1l
set-current-plot-pen "NBs2-c1u" plot NBs2c1u
set-current-plot-pen "NBs3-c1" plot NBs3c1
set-current-plot-pen "NBs3-c1l" plot NBs3c1l
set-current-plot-pen "NBs3-c1u" plot NBs3c1u
; Nitrogen balance for by cluster 2
let NBs0c2 mean [NB-hc-s0] of turtles with [ hclus = 2]
let NBs0c2-sd standard-deviation [NB-hc-s0] of turtles with [ hclus = 2]
let NBs0c2-se NBs0c2-sd / sqrt (count turtles with [ hclus = 2])
let NBs0c2-ci NBs0c2-se * 1.96
let NBs0c2l NBs0c2 - NBs0c2-ci
let NBs0c2u NBs0c2 + NBs0c2-ci
let NBs1c2 mean [NB-hc-s1] of turtles with [ hclus = 2]
let NBs1c2-sd standard-deviation [NB-hc-s1] of turtles with [ hclus = 2]
let NBs1c2-se NBs1c2-sd / sqrt (count turtles with [ hclus = 2])
let NBs1c2-ci NBs1c2-se * 1.96
let NBs1c2l NBs1c2 - NBs1c2-ci
let NBs1c2u NBs1c2 + NBs1c2-ci
let NBs2c2 mean [NB-hc-s2] of turtles with [ hclus = 2]
let NBs2c2-sd standard-deviation [NB-hc-s2] of turtles with [ hclus = 2]
let NBs2c2-se NBs2c2-sd / sqrt (count turtles with [ hclus = 2])
let NBs2c2-ci NBs2c2-se * 1.96
let NBs2c2l NBs2c2 - NBs2c2-ci
let NBs2c2u NBs2c2 + NBs2c2-ci
let NBs3c2 mean [NB-hc-s3] of turtles with [ hclus = 2]
let NBs3c2-sd standard-deviation [NB-hc-s3] of turtles with [ hclus = 2]
let NBs3c2-se NBs3c2-sd / sqrt (count turtles with [ hclus = 2])
let NBs3c2-ci NBs3c2-se * 1.96
let NBs3c2l NBs3c2 - NBs3c2-ci
let NBs3c2u NBs3c2 + NBs3c2-ci
set-current-plot "NB (fert-subsidy) farmtype2"
set-current-plot-pen "NBs0-c2" plot NBs0c2
set-current-plot-pen "NBs0-c2l" plot NBs0c2l
set-current-plot-pen "NBs0-c2u" plot NBs0c2u
set-current-plot-pen "NBs1-c2" plot NBs1c2
set-current-plot-pen "NBs1-c2l" plot NBs1c2l
set-current-plot-pen "NBs1-c2u" plot NBs1c2u
set-current-plot-pen "NBs2-c2" plot NBs2c2
set-current-plot-pen "NBs2-c2l" plot NBs2c2l
set-current-plot-pen "NBs2-c2u" plot NBs2c2u
set-current-plot-pen "NBs3-c2" plot NBs3c2
set-current-plot-pen "NBs3-c2l" plot NBs3c2l
set-current-plot-pen "NBs3-c2u" plot NBs3c2u
; Nitrogen balance for cluster 3
let NBs0c3 mean [NB-hc-s0] of turtles with [ hclus = 3]
let NBs0c3-sd standard-deviation [NB-hc-s0] of turtles with [ hclus = 3]
let NBs0c3-se NBs0c3-sd / sqrt (count turtles with [ hclus = 3])
let NBs0c3-ci NBs0c3-se * 1.96
let NBs0c3l NBs0c3 - NBs0c3-ci
let NBs0c3u NBs0c3 + NBs0c3-ci
let NBs1c3 mean [NB-hc-s1] of turtles with [ hclus = 3]
let NBs1c3-sd standard-deviation [NB-hc-s1] of turtles with [ hclus = 3]
let NBs1c3-se NBs1c3-sd / sqrt (count turtles with [ hclus = 3])
let NBs1c3-ci NBs1c3-se * 1.96
let NBs1c3l NBs1c3 - NBs1c3-ci
let NBs1c3u NBs1c3 + NBs1c3-ci
let NBs2c3 mean [NB-hc-s2] of turtles with [ hclus = 3]
let NBs2c3-sd standard-deviation [NB-hc-s2] of turtles with [ hclus = 3]
let NBs2c3-se NBs2c3-sd / sqrt (count turtles with [ hclus = 3])
let NBs2c3-ci NBs2c3-se * 1.96
let NBs2c3l NBs2c3 - NBs2c3-ci
let NBs2c3u NBs2c3 + NBs2c3-ci
let NBs3c3 mean [NB-hc-s3] of turtles with [ hclus = 3]
let NBs3c3-sd standard-deviation [NB-hc-s3] of turtles with [ hclus = 3]
let NBs3c3-se NBs3c3-sd / sqrt (count turtles with [ hclus = 3])
let NBs3c3-ci NBs3c3-se * 1.96
let NBs3c3l NBs3c3 - NBs3c3-ci
let NBs3c3u NBs3c3 + NBs3c3-ci
set-current-plot "NB (fert-subsidy) farmtype3"
set-current-plot-pen "NBs0-c3" plot NBs0c3
set-current-plot-pen "NBs0-c3l" plot NBs0c3l
set-current-plot-pen "NBs0-c3u" plot NBs0c3u
set-current-plot-pen "NBs1-c3" plot NBs1c3
set-current-plot-pen "NBs1-c3l" plot NBs1c3l
set-current-plot-pen "NBs1-c3u" plot NBs1c3u
set-current-plot-pen "NBs2-c3" plot NBs2c3
set-current-plot-pen "NBs2-c3l" plot NBs2c3l
set-current-plot-pen "NBs2-c3u" plot NBs2c3u
set-current-plot-pen "NBs3-c3" plot NBs3c3
set-current-plot-pen "NBs3-c3l" plot NBs3c3l
set-current-plot-pen "NBs3-c3u" plot NBs3c3u
End
To P6122.Phosphorus-balance
;phosphorus balance for whole population
let PBs0a mean [PB-S0] of turtles
let PBs0-sd standard-deviation [PB-s0] of turtles
let PBs0-se PBs0-sd / sqrt (count turtles)
let PBs0-ci PBs0-se * 1.96
let PBs0Al PBs0a - PBs0-ci
let PBs0Au PBs0a + PBs0-ci
let PBs1a mean [PB-S1] of turtles
let PBs1-sd standard-deviation [PB-s1] of turtles
let PBs1-se PBs1-sd / sqrt (count turtles)
let PBs1-ci PBs1-se * 1.96
let PBs1Al PBs1a - PBs1-ci
let PBs1Au PBs1a + PBs1-ci
let PBs2A mean [PB-S2] of turtles
let PBs2-sd standard-deviation [PB-s2] of turtles
let PBs2-se PBs2-sd / sqrt (count turtles )
let PBs2-ci PBs2-se * 1.96
let PBs2Al PBs2a - PBs2-ci
let PBs2Au PBs2a + PBs2-ci
let PBs3A mean [PB-S3] of turtles
let PBs3-sd standard-deviation [PB-s3] of turtles
let PBs3-se PBs3-sd / sqrt (count turtles)
let PBs3-ci PBs3-se * 1.96
let PBs3Al PBs3a - PBs3-ci
let PBs3Au PBs3a + PBs3-ci
set-current-plot "PB (fert-subsidy) population"
set-current-plot-pen "To-zero-sub" plot PBs0a
set-current-plot-pen "PBs0l" plot PBs0Al
set-current-plot-pen "PBs0u" plot PBs0Au
set-current-plot-pen "Current-sub" plot PBs1a
set-current-plot-pen "PBs1l" plot PBs1Al
set-current-plot-pen "PBs1u" plot PBs1Au
set-current-plot-pen "Reduced-sub" plot PBs2a
set-current-plot-pen "PBs2l" plot PBs2Al
set-current-plot-pen "PBs2u" plot PBs2Au
set-current-plot-pen "Universal-sub" plot PBs3a
set-current-plot-pen "PBs3l" plot PBs3Al
set-current-plot-pen "PBs3u" plot PBs3Au
; phosphorus balance for cluster 1
let PBs0c1 mean [PB-hc-s0] of turtles with [ hclus = 1]
let PBs0c1-sd standard-deviation [PB-hc-s0] of turtles with [hclus = 1]
let PBs0c1-se PBs0c1-sd / sqrt (count turtles with [hclus = 1])
let PBs0c1-ci PBs0c1-se * 1.96
let PBs0c1l PBs0c1 - PBs0c1-ci
let PBs0c1u PBs0c1 + PBs0c1-ci
let PBs1c1 mean [PB-hc-s1] of turtles with [ hclus = 1]
let PBs1c1-sd standard-deviation [PB-hc-s1] of turtles with [hclus = 1]
let PBs1c1-se PBs1c1-sd / sqrt (count turtles with [hclus = 1])
let PBs1c1-ci PBs1c1-se * 1.96
let PBs1c1l PBs1c1 - PBs1c1-ci
let PBs1c1u PBs1c1 + PBs1c1-ci
let PBs2c1 mean [PB-hc-s2] of turtles with [hclus = 1]
let PBs2c1-sd standard-deviation [PB-hc-s2] of turtles with [hclus = 1]
let PBs2c1-se PBs2c1-sd / sqrt (count turtles with [hclus = 1])
let PBs2c1-ci PBs2c1-se * 1.96
let PBs2c1l PBs2c1 - PBs2c1-ci
let PBs2c1u PBs2c1 + PBs2c1-ci
let PBs3c1 mean [PB-hc-s3] of turtles with [hclus = 1]
let PBs3c1-sd standard-deviation [PB-hc-s3] of turtles with [hclus = 1]
let PBs3c1-se PBs3c1-sd / sqrt (count turtles with [hclus = 1])
let PBs3c1-ci PBs3c1-se * 1.96
let PBs3c1l PBs3c1 - PBs3c1-ci
let PBs3c1u PBs3c1 + PBs3c1-ci
set-current-plot "PB (fert-subsidy) farmtype1"
set-current-plot-pen "PBs0-c1" plot PBs0c1
set-current-plot-pen "PBs0-c1l" plot PBs0c1l
set-current-plot-pen "PBs0-c1u" plot PBs0c1u
set-current-plot-pen "PBs1-c1" plot PBs1c1
set-current-plot-pen "PBs1-c1l" plot PBs1c1l
set-current-plot-pen "PBs1-c1u" plot PBs1c1u
set-current-plot-pen "PBs2-c1" plot PBs2c1
set-current-plot-pen "PBs2-c1l" plot PBs2c1l
set-current-plot-pen "PBs2-c1u" plot PBs2c1u
set-current-plot-pen "PBs3-c1" plot PBs3c1
set-current-plot-pen "PBs3-c1l" plot PBs3c1l
set-current-plot-pen "PBs3-c1u" plot PBs3c1u
; phosphorus balance for by cluster 2
let PBs0c2 mean [PB-hc-s0] of turtles with [ hclus = 2]
let PBs0c2-sd standard-deviation [PB-hc-s0] of turtles with [ hclus = 2]
let PBs0c2-se PBs0c2-sd / sqrt (count turtles with [ hclus = 2])
let PBs0c2-ci PBs0c2-se * 1.96
let PBs0c2l PBs0c2 - PBs0c2-ci
let PBs0c2u PBs0c2 + PBs0c2-ci
let PBs1c2 mean [PB-hc-s1] of turtles with [ hclus = 2]
let PBs1c2-sd standard-deviation [PB-hc-s1] of turtles with [ hclus = 2]
let PBs1c2-se PBs1c2-sd / sqrt (count turtles with [ hclus = 2])
let PBs1c2-ci PBs1c2-se * 1.96
let PBs1c2l PBs1c2 - PBs1c2-ci
let PBs1c2u PBs1c2 + PBs1c2-ci
let PBs2c2 mean [PB-hc-s2] of turtles with [ hclus = 2]
let PBs2c2-sd standard-deviation [PB-hc-s2] of turtles with [ hclus = 2]
let PBs2c2-se PBs2c2-sd / sqrt (count turtles with [ hclus = 2])
let PBs2c2-ci PBs2c2-se * 1.96
let PBs2c2l PBs2c2 - PBs2c2-ci
let PBs2c2u PBs2c2 + PBs2c2-ci
let PBs3c2 mean [PB-hc-s3] of turtles with [ hclus = 2]
let PBs3c2-sd standard-deviation [PB-hc-s3] of turtles with [ hclus = 2]
let PBs3c2-se PBs3c2-sd / sqrt (count turtles with [ hclus = 2])
let PBs3c2-ci PBs3c2-se * 1.96
let PBs3c2l PBs3c2 - PBs3c2-ci
let PBs3c2u PBs3c2 + PBs3c2-ci
set-current-plot "PB (fert-subsidy) farmtype2"
set-current-plot-pen "PBs0-c2" plot PBs0c2
set-current-plot-pen "PBs0-c2l" plot PBs0c2l
set-current-plot-pen "PBs0-c2u" plot PBs0c2u
set-current-plot-pen "PBs1-c2" plot PBs1c2
set-current-plot-pen "PBs1-c2l" plot PBs1c2l
set-current-plot-pen "PBs1-c2u" plot PBs1c2u
set-current-plot-pen "PBs2-c2" plot PBs2c2
set-current-plot-pen "PBs2-c2l" plot PBs2c2l
set-current-plot-pen "PBs2-c2u" plot PBs2c2u
set-current-plot-pen "PBs3-c2" plot PBs3c2
set-current-plot-pen "PBs3-c2l" plot PBs3c2l
set-current-plot-pen "PBs3-c2u" plot PBs3c2u
; phosphorus balance for cluster 3
let PBs0c3 mean [PB-hc-s0] of turtles with [ hclus = 3]
let PBs0c3-sd standard-deviation [PB-hc-s0] of turtles with [ hclus = 3]
let PBs0c3-se PBs0c3-sd / sqrt (count turtles with [ hclus = 3])
let PBs0c3-ci PBs0c3-se * 1.96
let PBs0c3l PBs0c3 - PBs0c3-ci
let PBs0c3u PBs0c3 + PBs0c3-ci
let PBs1c3 mean [PB-hc-s1] of turtles with [ hclus = 3]
let PBs1c3-sd standard-deviation [PB-hc-s1] of turtles with [ hclus = 3]
let PBs1c3-se PBs1c3-sd / sqrt (count turtles with [ hclus = 3])
let PBs1c3-ci PBs1c3-se * 1.96
let PBs1c3l PBs1c3 - PBs1c3-ci
let PBs1c3u PBs1c3 + PBs1c3-ci
let PBs2c3 mean [PB-hc-s2] of turtles with [ hclus = 3]
let PBs2c3-sd standard-deviation [PB-hc-s2] of turtles with [ hclus = 3]
let PBs2c3-se PBs2c3-sd / sqrt (count turtles with [ hclus = 3])
let PBs2c3-ci PBs2c3-se * 1.96
let PBs2c3l PBs2c3 - PBs2c3-ci
let PBs2c3u PBs2c3 + PBs2c3-ci
let PBs3c3 mean [PB-hc-s3] of turtles with [ hclus = 3]
let PBs3c3-sd standard-deviation [PB-hc-s3] of turtles with [ hclus = 3]
let PBs3c3-se PBs3c3-sd / sqrt (count turtles with [ hclus = 3])
let PBs3c3-ci PBs3c3-se * 1.96
let PBs3c3l PBs3c3 - PBs3c3-ci
let PBs3c3u PBs3c3 + PBs3c3-ci
set-current-plot "PB (fert-subsidy) farmtype3"
set-current-plot-pen "PBs0-c3" plot PBs0c3
set-current-plot-pen "PBs0-c3l" plot PBs0c3l
set-current-plot-pen "PBs0-c3u" plot PBs0c3u
set-current-plot-pen "PBs1-c3" plot PBs1c3
set-current-plot-pen "PBs1-c3l" plot PBs1c3l
set-current-plot-pen "PBs1-c3u" plot PBs1c3u
set-current-plot-pen "PBs2-c3" plot PBs2c3
set-current-plot-pen "PBs2-c3l" plot PBs2c3l
set-current-plot-pen "PBs2-c3u" plot PBs2c3u
set-current-plot-pen "PBs3-c3" plot PBs3c3
set-current-plot-pen "PBs3-c3l" plot PBs3c3l
set-current-plot-pen "PBs3-c3u" plot PBs3c3u
End
To P6123.Potassium-balance
;potassium balance for whole population
let KBs0a mean [KB-S0] of turtles
let KBs0-sd standard-deviation [KB-s0] of turtles
let KBs0-se KBs0-sd / sqrt (count turtles)
let KBs0-ci KBs0-se * 1.96
let KBs0Al KBs0a - KBs0-ci
let KBs0Au KBs0a + KBs0-ci
let KBs1a mean [KB-S1] of turtles
let KBs1-sd standard-deviation [KB-s1] of turtles
let KBs1-se KBs1-sd / sqrt (count turtles)
let KBs1-ci KBs1-se * 1.96
let KBs1Al KBs1a - KBs1-ci
let KBs1Au KBs1a + KBs1-ci
let KBs2A mean [KB-S2] of turtles
let KBs2-sd standard-deviation [KB-s2] of turtles
let KBs2-se KBs2-sd / sqrt (count turtles )
let KBs2-ci KBs2-se * 1.96
let KBs2Al KBs2a - KBs2-ci
let KBs2Au KBs2a + KBs2-ci
let KBs3A mean [KB-S3] of turtles
let KBs3-sd standard-deviation [KB-s3] of turtles
let KBs3-se KBs3-sd / sqrt (count turtles)
let KBs3-ci KBs3-se * 1.96
let KBs3Al KBs3a - KBs3-ci
let KBs3Au KBs3a + KBs3-ci
set-current-plot "KB (fert-subsidy) population"
set-current-plot-pen "To-zero-sub" plot KBs0a
set-current-plot-pen "KBs0l" plot KBs0Al
set-current-plot-pen "KBs0u" plot KBs0Au
set-current-plot-pen "Current-sub" plot KBs1a
set-current-plot-pen "KBs1l" plot KBs1Al
set-current-plot-pen "KBs1u" plot KBs1Au
set-current-plot-pen "Reduced-sub" plot KBs2a
set-current-plot-pen "KBs2l" plot KBs2Al
set-current-plot-pen "KBs2u" plot KBs2Au
set-current-plot-pen "Universal-sub" plot KBs3a
set-current-plot-pen "KBs3l" plot KBs3Al
set-current-plot-pen "KBs3u" plot KBs3Au
; potassium balance for cluster 1
let KBs0c1 mean [KB-hc-s0] of turtles with [ hclus = 1]
let KBs0c1-sd standard-deviation [KB-hc-s0] of turtles with [hclus = 1]
let KBs0c1-se KBs0c1-sd / sqrt (count turtles with [hclus = 1])
let KBs0c1-ci KBs0c1-se * 1.96
let KBs0c1l KBs0c1 - KBs0c1-ci
let KBs0c1u KBs0c1 + KBs0c1-ci
let KBs1c1 mean [KB-hc-s1] of turtles with [ hclus = 1]
let KBs1c1-sd standard-deviation [KB-hc-s1] of turtles with [hclus = 1]
let KBs1c1-se KBs1c1-sd / sqrt (count turtles with [hclus = 1])
let KBs1c1-ci KBs1c1-se * 1.96
let KBs1c1l KBs1c1 - KBs1c1-ci
let KBs1c1u KBs1c1 + KBs1c1-ci
let KBs2c1 mean [KB-hc-s2] of turtles with [hclus = 1]
let KBs2c1-sd standard-deviation [KB-hc-s2] of turtles with [hclus = 1]
let KBs2c1-se KBs2c1-sd / sqrt (count turtles with [hclus = 1])
let KBs2c1-ci KBs2c1-se * 1.96
let KBs2c1l KBs2c1 - KBs2c1-ci
let KBs2c1u KBs2c1 + KBs2c1-ci
let KBs3c1 mean [KB-hc-s3] of turtles with [hclus = 1]
let KBs3c1-sd standard-deviation [KB-hc-s3] of turtles with [hclus = 1]
let KBs3c1-se KBs3c1-sd / sqrt (count turtles with [hclus = 1])
let KBs3c1-ci KBs3c1-se * 1.96
let KBs3c1l KBs3c1 - KBs3c1-ci
let KBs3c1u KBs3c1 + KBs3c1-ci
set-current-plot "KB (fert-subsidy) farmtype1"
set-current-plot-pen "KBs0-c1" plot KBs0c1
set-current-plot-pen "KBs0-c1l" plot KBs0c1l
set-current-plot-pen "KBs0-c1u" plot KBs0c1u
set-current-plot-pen "KBs1-c1" plot KBs1c1
set-current-plot-pen "KBs1-c1l" plot KBs1c1l
set-current-plot-pen "KBs1-c1u" plot KBs1c1u
set-current-plot-pen "KBs2-c1" plot KBs2c1
set-current-plot-pen "KBs2-c1l" plot KBs2c1l
set-current-plot-pen "KBs2-c1u" plot KBs2c1u
set-current-plot-pen "KBs3-c1" plot KBs3c1
set-current-plot-pen "KBs3-c1l" plot KBs3c1l
set-current-plot-pen "KBs3-c1u" plot KBs3c1u
; potassium balance for by cluster 2
let KBs0c2 mean [KB-hc-s0] of turtles with [ hclus = 2]
let KBs0c2-sd standard-deviation [KB-hc-s0] of turtles with [ hclus = 2]
let KBs0c2-se KBs0c2-sd / sqrt (count turtles with [ hclus = 2])
let KBs0c2-ci KBs0c2-se * 1.96
let KBs0c2l KBs0c2 - KBs0c2-ci
let KBs0c2u KBs0c2 + KBs0c2-ci
let KBs1c2 mean [KB-hc-s1] of turtles with [ hclus = 2]
let KBs1c2-sd standard-deviation [KB-hc-s1] of turtles with [ hclus = 2]
let KBs1c2-se KBs1c2-sd / sqrt (count turtles with [ hclus = 2])
let KBs1c2-ci KBs1c2-se * 1.96
let KBs1c2l KBs1c2 - KBs1c2-ci
let KBs1c2u KBs1c2 + KBs1c2-ci
let KBs2c2 mean [KB-hc-s2] of turtles with [ hclus = 2]
let KBs2c2-sd standard-deviation [KB-hc-s2] of turtles with [ hclus = 2]
let KBs2c2-se KBs2c2-sd / sqrt (count turtles with [ hclus = 2])
let KBs2c2-ci KBs2c2-se * 1.96
let KBs2c2l KBs2c2 - KBs2c2-ci
let KBs2c2u KBs2c2 + KBs2c2-ci
let KBs3c2 mean [KB-hc-s3] of turtles with [ hclus = 2]
let KBs3c2-sd standard-deviation [KB-hc-s3] of turtles with [ hclus = 2]
let KBs3c2-se KBs3c2-sd / sqrt (count turtles with [ hclus = 2])
let KBs3c2-ci KBs3c2-se * 1.96
let KBs3c2l KBs3c2 - KBs3c2-ci
let KBs3c2u KBs3c2 + KBs3c2-ci
set-current-plot "KB (fert-subsidy) farmtype2"
set-current-plot-pen "KBs0-c2" plot KBs0c2
set-current-plot-pen "KBs0-c2l" plot KBs0c2l
set-current-plot-pen "KBs0-c2u" plot KBs0c2u
set-current-plot-pen "KBs1-c2" plot KBs1c2
set-current-plot-pen "KBs1-c2l" plot KBs1c2l
set-current-plot-pen "KBs1-c2u" plot KBs1c2u
set-current-plot-pen "KBs2-c2" plot KBs2c2
set-current-plot-pen "KBs2-c2l" plot KBs2c2l
set-current-plot-pen "KBs2-c2u" plot KBs2c2u
set-current-plot-pen "KBs3-c2" plot KBs3c2
set-current-plot-pen "KBs3-c2l" plot KBs3c2l
set-current-plot-pen "KBs3-c2u" plot KBs3c2u
; potassium balance for cluster 3
let KBs0c3 mean [KB-hc-s0] of turtles with [ hclus = 3]
let KBs0c3-sd standard-deviation [KB-hc-s0] of turtles with [ hclus = 3]