-
Notifications
You must be signed in to change notification settings - Fork 1
/
flsms.control.r
1246 lines (1172 loc) · 80.7 KB
/
flsms.control.r
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
### class ######################################################################
validFLSMS.control <- function(object){
valid.test.output<-c(0,1,2,3,4,11,12,13,19,51,52,53)
if (!(object@test.output %in% valid.test.output))
return(paste("value of test.ouput must have a value in:", valid.test.output))
if (object@VPA.mode<0 & object@VPA.mode>2)
return("value of VPA.mode must be in the range 0-2")
if (object@first.year<0 | object@last.year<0 | object@first.year > object@last.year)
return(paste("value of first.year:",object@first.year, "or last.year",object@last.year, "is wrong"))
if (object@last.year.model>object@last.year)
return(paste("last.year model(",object@last.year.model,") must be <= last.year (",object@last.year.model,")",sep=""))
if (object@last.year.model<=object@first.year)
return("last.year.model must be > first.year")
if (object@last.season < 1)
return("last.season must be >= 1")
if (object@last.season.last.year < 1 | object@last.season.last.year > object@last.season)
return("last.season.last.year must be in the range 1:last.season")
# Everything is fine
return(TRUE)
}
setClass("FLSMS.control",
representation(
test.output ="numeric",
OP.output ="numeric",
VPA.mode ="numeric",
no.areas ="numeric",
first.year ="numeric",
first.year.model ="numeric",
last.year ="numeric",
last.year.model ="numeric",
last.season ="numeric",
last.season.last.year="numeric",
no.species ="numeric",
species.names ="vector",
first.age ="numeric",
rec.season ="numeric",
max.age.all ="numeric",
species.info ="matrix",
use.known.rec ="numeric",
beta.cor ="vector",
SSB.R.year.first ="vector",
SSB.R.year.last ="vector",
obj.func.weight ="matrix",
phase.rec ="numeric",
phase.rec.older ="numeric",
phase.F.y ="numeric",
phase.F.y.spline ="numeric",
phase.F.q ="numeric",
phase.F.a ="numeric",
phase.catchability ="numeric",
phase.SSB.R.alfa ="numeric",
phase.SSB.R.beta ="numeric",
min.catch.CV ="numeric",
min.SR.CV ="numeric",
discard ="vector",
combined.catches ="vector",
seasonal.catch.s2 ="vector",
catch.s2.group ="vector",
catch.season.age ="vector",
avg.F.ages ="matrix",
min.catch ="vector",
catch.sep.year ="vector",
catch.spline.year ="vector",
zero.catch.year.season="numeric",
zero.catch.season.age="numeric",
fix.F.factor ="vector",
est.calc.sigma ="vector",
read.HCR ="numeric",
incl.stom.all ="numeric",
use.Nbar ="numeric",
M2.iterations ="numeric",
max.M2.sum2 ="numeric",
stom.likelihood ="numeric",
stomach.variance ="numeric",
simple.ALK ="numeric",
consum ="numeric",
size.select.model ="numeric",
L50.mesh ="vector",
size.selection ="vector",
sum.stom.like ="vector",
stom.obs.var ="vector",
stom.max.sumP ="vector",
var.scale.stom ="vector",
size.other.food.suit="vector",
min.stom.cont ="vector",
max.stom.sampl ="vector",
prey.pred.size.fac ="vector",
stom.type.include ="vector",
use.overlap ="numeric",
phase.vulnera ="numeric",
phase.other.suit.slope ="numeric",
phase.pref.size.ratio ="numeric",
phase.pref.size.ratio.correction ="numeric",
phase.prey.size.adjustment ="numeric",
phase.var.size.ratio ="numeric",
phase.season.overlap ="numeric",
phase.stom.var ="numeric",
phase.mesh.adjust ="numeric"
)
,
prototype=prototype(
test.output =0,
OP.output =0,
VPA.mode =0,
no.areas =1,
first.year =1900,
first.year.model=1901,
last.year =1901,
last.year.model =1901,
last.season =1,
last.season.last.year=1,
no.species =1,
species.names =as.vector("sp1",mode="character"),
first.age =0,
rec.season =1,
max.age.all =0,
species.info =matrix(0,ncol=11,nrow=1,dimnames=list(c("sp1"),c("last-age","first-age F>0","last-age-selec","effort",
"last-age-likelihood","+group","predator","prey","SSB/R","SpawningQ","RecAdd2"))),
use.known.rec =0,
beta.cor =as.vector(1.0E6,mode="numeric"),
SSB.R.year.first=as.vector(0,mode="numeric"),
SSB.R.year.last=as.vector(0,mode="numeric"),
obj.func.weight =matrix(1,ncol=5,nrow=1,dimnames=list(c("sp1"),c("catch","survey","SSB/R",
"stomach1","stomach2"))),
phase.rec =1,
phase.rec.older =1,
phase.F.y =1,
phase.F.y.spline=-1,
phase.F.q =1,
phase.F.a =1,
phase.catchability=1,
phase.SSB.R.alfa=1,
phase.SSB.R.beta=1,
min.catch.CV =0.2,
min.SR.CV =0.2,
discard =as.vector(0,mode="list"),
combined.catches=as.vector(0,mode="list"),
seasonal.catch.s2=as.vector(0,mode="list"),
catch.s2.group =as.vector(0,mode="list"),
catch.season.age=as.vector(0,mode="list"),
avg.F.ages =matrix(0,ncol=2,nrow=1,dimnames=list(c("sp1"),c("first-age","last-age"))),
min.catch =as.vector(-5,mode="numeric"),
catch.sep.year =as.vector(0,mode="list"),
catch.spline.year =as.vector(0,mode="list"),
zero.catch.year.season =0,
zero.catch.season.age =0,
fix.F.factor = as.vector(1,mode="numeric"),
est.calc.sigma =as.vector(0,mode="numeric"),
read.HCR =0,
incl.stom.all =0,
use.Nbar =0,
M2.iterations =3,
max.M2.sum2 =0.0,
stom.likelihood =1,
stomach.variance =1,
simple.ALK =0,
consum =0,
size.select.model =2,
L50.mesh =as.vector(0,mode="numeric"),
size.selection =as.vector(0,mode="numeric"),
sum.stom.like =as.vector(0,mode="numeric"),
stom.obs.var =as.vector(0,mode="numeric"),
stom.max.sumP =as.vector(0,mode="numeric"),
var.scale.stom =as.vector(0,mode="numeric"),
size.other.food.suit=as.vector(0,mode="numeric"),
min.stom.cont =as.vector(0,mode="numeric"),
max.stom.sampl =as.vector(0,mode="numeric"),
prey.pred.size.fac =as.vector(0,mode="numeric"),
stom.type.include =as.vector(1,mode="numeric"),
use.overlap =0,
phase.vulnera =2,
phase.other.suit.slope =2,
phase.pref.size.ratio =2,
phase.pref.size.ratio.correction =-1,
phase.prey.size.adjustment =-1,
phase.var.size.ratio =-1,
phase.season.overlap =-1,
phase.stom.var =2,
phase.mesh.adjust =-1
)
,
validity=validFLSMS.control
)
setValidity("FLSMS.control", validFLSMS.control)
# in final version remove(validSMS.control) # We do not need this function any more
### End class ###########################################################
### Methods #############################################################
FLSMS.control <- function(
FLSMS=NULL,
first.year=1900,
first.year.model=1900,
last.year=first.year+1,
last.season=1,
no.species=1,
no.VPA.predators=0,
no.other.predators=0,
species.names=c("sp1"),
first.age=0,
max.age.all=10)
{
if (is.null(FLSMS)){
if (no.species == 1) {
no.VPA.sp<-no.species
no.predators<-0
no.other.predators<-0
}
if (no.species>1) {
if (no.other.predators>=no.species) stop("no.other.predators cannot be larger than no.species")
no.VPA.sp<-no.species-no.other.predators
no.predators<-no.other.predators+no.VPA.predators
}
if (species.names[1] != c("sp1") & length(species.names)!=no.species)
stop("no.species is diffrent from number of species names")
species.info<-matrix(0,ncol=11,nrow=no.species,dimnames=list(species.names,c("last-age","first-age F>0","effort",
"last-age-selec","last-age-likelihood","+group","predator","prey","SSB/R","SpawningQ","RecAdd2")))
species.info[,1]<-max.age.all
species.info[,2]<-first.age
species.info[,3]<-max.age.all
species.info[,4]<-0
species.info[,5]<-max.age.all
species.info[,6]<-1
species.info[,7]<-c(rep(0,no.predators),rep(0,no.VPA.sp-no.VPA.predators))
species.info[,8]<-c(rep(0,no.other.predators),rep(1,no.VPA.sp))
species.info[,9]<-c(rep(0,no.other.predators),rep(3,no.VPA.sp))
species.info[,10]<-c(rep(0,no.other.predators),rep(1,no.VPA.sp))
species.info[,11]<-c(rep(0,no.other.predators),rep(0,no.VPA.sp))
catch.s2.group<-vector("list", length=no.VPA.sp);
for (j in 1:no.VPA.sp) catch.s2.group[[j]]<-as.integer(first.age:(first.age+2))
catch.season.age<-vector("list", length=no.VPA.sp)
for (j in 1:no.VPA.sp) {
if (last.season>1) catch.season.age[[j]]<-as.integer(first.age:(first.age+1)) else
catch.season.age[[j]]<-as.integer(first.age)
}
catch.sep.year<-vector("list", length=no.VPA.sp)
for (j in 1:no.VPA.sp) catch.sep.year[[j]]<-as.integer(first.year.model);
catch.spline.year<-vector("list", length=no.VPA.sp)
for (j in 1:no.VPA.sp) catch.spline.year[[j]]<-as.integer(first.year.model);
zero.catch.year.season<-as.integer(0)
zero.catch.season.age<-as.integer(0)
res <- new("FLSMS.control",
test.output=as.integer(0) ,
OP.output=as.integer(0),
VPA.mode=as.integer(0),
no.areas=as.integer(1),
first.year=as.integer(first.year),
first.year.model=as.integer(first.year.model),
last.year=as.integer(last.year),
last.year.model=as.integer(last.year),
last.season=as.integer(last.season),
last.season.last.year=as.integer(last.season),
no.species=as.integer(no.species),
first.age=as.integer(first.age),
max.age.all=as.integer(max.age.all),
species.names=species.names,
species.info=species.info,
use.known.rec=as.integer(0),
beta.cor =rep(1E6,no.VPA.sp),
SSB.R.year.first=rep(first.year.model,no.VPA.sp),
SSB.R.year.last=rep(last.year,no.VPA.sp) ,
obj.func.weight =matrix(1,ncol=4,nrow=no.species,dimnames=list(species.names,
c("catch","survey","SSB/R","stomach1","stomach2"))),
seasonal.catch.s2=rep(0,no.VPA.sp),
catch.s2.group=catch.s2.group,
catch.season.age=catch.season.age,
avg.F.ages =matrix(0,ncol=2,nrow=no.VPA.sp,
dimnames=list(species.names[1:no.VPA.sp],c("first-age","last-age"))),
min.catch=rep(-5,no.VPA.sp),
catch.sep.year=catch.sep.year,
catch.spline.year=catch.spline.year,
zero.catch.year.season=zero.catch.year.season,
zero.catch.season.age=zero.catch.season.age,
fix.F.factor=rep(1,no.VPA.sp),
est.calc.sigma =c(0,0,0),
size.selection =rep(0,no.predators),
L50.mesh =rep(-1,no.VPA.sp),
var.scale.stom =rep(0,no.predators),
size.other.food.suit=rep(0,no.predators),
min.stom.cont =rep(1E-4,no.predators),
max.stom.sampl =rep(1E4,no.predators),
prey.pred.size.fac =rep(0.5,no.predators),
stom.type.include =rep(1,no.predators)
)
}
else { # We re-use an FLSMS.control object
if (!inherits(FLSMS, "FLSMS"))
stop("FLSMS must be an 'FLSMS' object!")
res <- FLSMS@control
# ... and possibly redefine some of its parameters
if (!missing(test.output))
res@test.output <- test.output
if (!missing(VPA.mode))
res@VPA.mode <- as.integer(VPA.mode)
if (!missing(no.areas))
res@no.areas <- as.integer(no.areas)
if (!missing(first.year))
res@first.year <- first.year
if (!missing(first.year.model))
res@first.year.model <- first.year.model
if (!missing(last.year))
res@last.year <- last.year
if (!missing(last.year.model))
res@last.year.model <- as.integer(last.year.model)
if (!missing(last.season))
res@last.season <- as.integer(last.season)
if (!missing(last.season.last.year))
res@last.season.last.year <- as.integer(last.season.last.year)
if (!missing(no.species))
res@no.species <- as.integer(no.species)
if (!missing(first.age))
res@first.age <- as.integer(first.age)
if (!missing(rec.season))
res@rec.season <- as.integer(rec.season)
if (!missing(max.age.all))
res@max.age.all <- as.integer(max.age.all)
if (!missing(species.info))
res@species.info <- as.matrix(species.info)
# Verify that this object is valid
test <- validObject(res)
if (!test) stop("Invalid object:", test)
}
return(res)
}
write.FLSMS.control<-function(control,file="sms.dat",path=NULL,write.multi=TRUE,nice=TRUE,writeSpNames=T,expand=F) {
wr.matrix<-function(m,text){
cat("# ",text,"\n",file=file,append=TRUE)
for (j in (1:dim(m)[1])) cat(m[j,],"\n",file=file,append=TRUE)
}
wr.matrix.nice<-function(m,sp){
for (j in (1:dim(m)[1])) cat(m[j,]," #",sp[j],"\n",file=file,append=TRUE)
}
wr.vector.nice<-function(m,sp){
cat("# ",formatC(sp,width=11),"\n ",formatC(m,width=11),"\n",file=file,append=TRUE)
}
wr.vector.expand<-function(m,sp){
for (j in 1:length(m)) cat(formatC(m[j],width=11)," # ",formatC(sp[j],width=11),"\n",file=file,append=TRUE)
}
wr.list<-function(l,text1,text2){
for (j in 1:length(l)) cat(length(l[[j]])," ",file=file,append=TRUE)
cat("\t#",text1,"\n# ",text2,"\n",file=file,append=TRUE)
for (j in 1:length(l)) cat(l[[j]],"\n",file=file,append=TRUE)
}
wr.list.nice<-function(l,text1,text2,sp){
cat("#",text1,"\n#",formatC(sp,width=11),"\n",file=file,append=TRUE)
for (j in 1:length(l)) cat(formatC(length(l[[j]]),width=12),file=file,append=TRUE)
cat("\n# ",text2,"\n",file=file,append=TRUE)
for (j in 1:length(l)) cat(l[[j]],"\t# ",sp[j],"\n",file=file,append=TRUE)
}
wr.list.expand<-function(l,text1,text2,sp){
#cat("#",text1,"\n#",formatC(sp,width=11),"\n",file=file,append=TRUE)
cat("#",text1,"\n",file=file,append=TRUE)
for (j in 1:length(l)) cat(formatC(length(l[[j]]),width=12), " #",formatC(sp[j],width=11),'\n', file=file,append=TRUE)
cat("\n# ",text2,"\n",file=file,append=TRUE)
for (j in 1:length(l)) cat(l[[j]],"\t# ",sp[j],"\n",file=file,append=TRUE)
}
wr.list2<-function(l,text1,text2){
for (j in 1:length(l)) {
ifelse(l[[j]]==0, out<-0,out<-length(l[[j]]))
cat(out," ",file=file,append=TRUE)
}
cat("\t#",text1,"\n# ",text2,"\n",file=file,append=TRUE)
for (j in 1:length(l)) cat(l[[j]],"\n",file=file,append=TRUE)
}
wr.list2.nice<-function(l,text1,text2,sp){
cat("#",text1,"\n#",formatC(sp,width=11),"\n",file=file,append=TRUE)
for (j in 1:length(l)) {
ifelse(l[[j]]==0, out<-0,out<-length(l[[j]]))
cat(formatC(out,width=12),file=file,append=TRUE)
}
cat("\n# ",text2,"\n",file=file,append=TRUE)
for (j in 1:length(l)) cat(l[[j]],"\t# ",sp[j],"\n",file=file,append=TRUE)
}
if (!inherits(control, "FLSMS.control"))
stop(paste("control" ,"must be an 'FLSMS.contol' object!"))
old.path<-getwd()
if (!is.null(path)) setwd(path) else path<-old.path
sepLine<-"########################################\n"
last.pred<-1
sp.names<-slot(control,"species.names")
nsp<<-control@no.species
for (ii in (1:nsp)) if (control@species.info[ii,'predator']!=2) {first.VPA<-ii; break;} #first VPA species number
VPA.species<-sp.names[first.VPA:length(sp.names)]
for (ii in (1:nsp)) if (control@species.info[ii,'predator']==0) {last.pred<-ii-1; break;} #first VPA species number
pred.species<-sp.names[1:last.pred]
cat("# sms.dat option file\n",file=file)
cat('# the character "#" is used as comment character, such that all text and numbers\n# after # are skipped by the SMS program\n#\n',file=file, append=TRUE)
n.<-slotNames(control)
for (x in n.) {
switch(x,
"test.output" ={ if (nice) {
cat(sepLine,file=file,append=TRUE)
cat("# Produce test output (option test.output)\n",
"# 0 no test output\n",
"# 1 output file sms.dat and file fleet.info.dat as read in\n",
"# 2 output all single species input files as read in\n",
"# 3 output all multi species input files as read in\n",
"# 4 output option overview\n",
"#\n",
"# 11 output between phases output\n",
"# 12 output iteration (obj function) output\n",
"# 13 output stomach parameters\n",
"# 19 Both 11, 12 and 13\n",
"#\n",
"# Forecast options\n",
"# 51 output hcr_option.dat file as read in\n",
"# 52 output prediction output summary\n",
"# 53 output prediction output detailed\n",
slot(control,x),"\n",file=file,append=T,sep="")
}
else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"OP.output" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("# Produce output for SMS-OP program. 0=no, 1=yes\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"VPA.mode" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("# Single/Multispecies mode (option VPA.mode)\n",
"# 0=single species mode\n",
"# 1=multi species mode, but Z=F+M (used for initial food suitability parm. est.)\n",
"# 2=multi species mode, Z=F+M1+M2\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"no.areas" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("# Number of areas for multispecies run (default=1)\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"first.year" ={if (nice) {
cat("#\n#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&\n#\n",
"# single species parameters\n#\n",
"#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&\n#\n",
file=file,append=T,sep='')
cat("## first year of input data (option first.year)\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"first.year.model" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## first year used in the model (option first.year.model)\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"last.year" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## last year of input data (option last.year)\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"last.year.model" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## last year used in the model (option last.year.model)\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"last.season" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## number of seasons (option last.season). Use 1 for annual data\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"last.season.last.year"={if (nice) {
cat(sepLine,file=file,append=T)
cat("## last season last year (option last.season.last.year). Use 1 for annual data\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"no.species" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## number of species (option no.species)\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"species.names" ={ cat(sepLine,file=file,append=T)
cat("# Species names, for information only. See file species_names.in \n# ",sp.names,"\n",file=file,append=T)
},
"first.age" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## first age all species (option first.age)\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"rec.season" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## recruitment season (option rec.season). Use 1 for annual data\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"max.age.all" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## maximum age for any species(max.age.all)\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"species.info" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## various information by species\n",
"# 1. last age \n",
"# 2. first age where catch data are used (else F=0 assumed)\n",
"# 3. last age with age dependent fishing selection\n",
"# 4. Esimate F year effect from effort data. 0=no, 1=yes\n",
"# 5. Last age included in the catch at age likelihood (normally last age)\n",
"# 6. plus group, 0=no plus group, 1=plus group\n",
"# 7. predator species, 0=no, 1=VPA predator, 2=Other predator\n",
"# 8. prey species, 0=no, 1=yes\n",
"# 9. Stock Recruit relation\n",
"# 1=Ricker, 2=Beverton & Holt, 3=Geom mean,\n",
"# 4= Hockey stick, 5=hockey stick with smoother,\n",
"# 51=Ricker with estimated temp effect,\n",
"# 52=Ricker with known temp effect,\n",
"# >100= hockey stick with known breakpoint (given as input)\n",
"# 10. Spawning season (not used yet, but set to 1)\n",
"# 11. Additional data for Stock Recruit relation\n",
"##\n",
file=file,append=T,sep="")
wr.matrix.nice(slot(control,x),paste(1:length(sp.names),sp.names))
} else wr.matrix(slot(control,x),x)
},
"use.known.rec" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## use input recruitment estimate (option use.known.rec)\n",
"# 0=estimate all recruitments\n",
"# 1=yes use input recruitment from file known_recruitment.in\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"beta.cor" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## adjustment factor to bring the beta parameter close to one (option beta.cor)\n",
file=file,append=T,sep="")
if (expand) wr.vector.expand(slot(control,x),VPA.species) else wr.vector.nice(slot(control,x),VPA.species)
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"SSB.R.year.first" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## year range for data included to fit the R-SSB relation (option SSB.R.year.range)\n",
"# first (option SSB.R.year.first) and last (option SSB.R.year.last) year to consider.\n",
"# the value -1 indicates the use of the first (and last) available year in time series\n",
"# first year by species\n",
file=file,append=T,sep="")
if (expand) wr.vector.expand(slot(control,x),VPA.species) else wr.vector.nice(slot(control,x),VPA.species)
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"SSB.R.year.last" ={if (nice) {
cat("# last year by species\n",
file=file,append=T,sep="")
if (expand) wr.vector.expand(slot(control,x),VPA.species) else wr.vector.nice(slot(control,x),VPA.species)
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"obj.func.weight" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## Objective function weighting by species (option objective.function.weight)\n",
"# first=catch observations,\n",
"# second=CPUE observations,\n",
"# third=SSB/R relations\n",
"# fourth=stomach observations, weight proportions \n",
"# fifth=stomach observations, number at length \n",
"##\n",
file=file,append=T,sep="")
wr.matrix.nice(slot(control,x),paste(1:length(sp.names),sp.names))
} else wr.matrix(slot(control,x),x)
},
"phase.rec" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## parameter estimation phases for single species parameters\n",
"# phase.rec (stock numbers, first age) (default=1)\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"phase.rec.older" ={if (nice) {
cat("# phase.rec.older (stock numbers, first year and all ages) (default=1)\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"phase.F.y" ={if (nice) {
cat("# phase.F.y (year effect in F model) (default=1)\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"phase.F.y.spline" ={if (nice) {
cat("# phase.F.y.spline (year effect in F model, implemented as spline function)\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"phase.F.q" ={if (nice) {
cat("# phase.F.q (season effect in F model) (default=1)\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"phase.F.a" ={if (nice) {
cat("# phase.F.a (age effect in F model) (default=1)\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"phase.catchability"={if (nice) {
cat("# phase.catchability (survey catchability) (default=1)\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"phase.SSB.R.alfa" ={if (nice) {
cat("# phase.SSB.R.alfa (alfa parameter in SSB-recruitment relation) (default=1)\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"phase.SSB.R.beta" ={if (nice) {
cat("# phase.SSB.R.beta (beta parameter in SSB-recruitment relation) (default=1)\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"min.catch.CV" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## minimum CV of catch observation used in ML-estimation (option min.catch.CV)\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"min.SR.CV" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## minimum CV of catch SSB-recruitment relation used in ML-estimation (option min.SR.CV)\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"discard" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## Use proportion landed information in calculation of yield (option calc.discard)\n",
"# 0=all catches are included in yield\n",
"# 1=yield is calculated from proportion landed (file proportion_landed.in)\n",
file=file,append=T,sep="")
if (expand) wr.vector.expand(slot(control,x),VPA.species) else wr.vector.nice(slot(control,x),VPA.species)
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"combined.catches" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## use seasonal or annual catches in the objective function (option combined.catches)\n",
"# do not change this options from default=0, without looking in the manual\n",
"# 0=annual catches with annual time steps or seasonal catches with seasonal time steps\n",
"# 1=annual catches with seasonal time steps, read seasonal relative F from file F_q_ini.in (default=0)\n",
file=file,append=T,sep="")
if (expand) wr.vector.expand(slot(control,x),VPA.species) else wr.vector.nice(slot(control,x),VPA.species)
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"seasonal.catch.s2" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## use seasonal or common combined variances for catch observation\n",
"# seasonal=0, common=1 (use 1 for annual data)\n",
file=file,append=T,sep="")
if (expand) wr.vector.expand(slot(control,x),VPA.species) else wr.vector.nice(slot(control,x),VPA.species)
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"catch.s2.group" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## \n",file=file,append=T)
if (expand) wr.list.expand(slot(control,x),"catch observations: number of separate catch variance groups by species",
"first age group in each catch variance group",VPA.species)
if (!expand) wr.list.nice(slot(control,x),"catch observations: number of separate catch variance groups by species",
"first age group in each catch variance group",VPA.species)
} else wr.list(slot(control,x),"n.catch.s2.group",x)
},
"catch.season.age" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## \n",file=file,append=T)
if (expand) wr.list.expand(slot(control,x),"catch observations: number of separate catch seasonal component groups by species",
"first ages in each seasonal component group by species",VPA.species)
if (!expand) wr.list.nice(slot(control,x),"catch observations: number of separate catch seasonal component groups by species",
"first ages in each seasonal component group by species",VPA.species)
} else wr.list(slot(control,x),"n.catch.s2.group",x)
},
"avg.F.ages" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## first and last age in calculation of average F by species (option avg.F.ages)\n",
file=file,append=T)
wr.matrix.nice(slot(control,x),VPA.species)
} else wr.matrix(slot(control,x),x)
},
"min.catch" = {if (nice) {
cat(sepLine,file=file,append=T)
cat("## minimum 'observed' catch, (option min.catch). You cannot log zero catch at age!\n",
"#\n",
"# 0 ignore observation in likelihood\n#\n",
"# negative value gives percentage (e.g. -10 ~ 10%) of average catch in age-group for input catch=0\n",
"# negative value less than -100 substitute all catches by the option/100 /100 *average catch in the age group for catches less than (average catch*-option/10000\n",
"#\n",
"# if option>0 then will zero catches be replaced by catch=option\n",
"#\n",
"# else if option<0 and option >-100 and catch=0 then catches will be replaced by catch=average(catch at age)*(-option)/100\n",
"# else if option<-100 and catch < average(catch at age)*(-option)/10000 then catches will be replaced by catch=average(catch at age)*(-option)/10000\n",
file=file,append=T,sep="")
if (expand) wr.vector.expand(slot(control,x),VPA.species) else wr.vector.nice(slot(control,x),VPA.species)
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"catch.sep.year" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## \n",file=file,append=T)
if (expand) wr.list.expand(slot(control,x),"catch observations: number of year groups with the same age and seasonal selection","first year in each group (please note #1 will always be changed to first model year)",VPA.species)
if (!expand) wr.list.nice(slot(control,x),"catch observations: number of year groups with the same age and seasonal selection","first year in each group (please note #1 will always be changed to first model year)",VPA.species)
} else wr.list(slot(control,x),"catch.sep.year",x)
},
"catch.spline.year" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## \n",file=file,append=T)
if (expand) wr.list.expand(slot(control,x),"number of nodes for year effect Fishing mortality spline\n# 1=no spline (use one Fy for each year), >1 number of nodes","first year in each group",VPA.species)
if (!expand) wr.list.nice(slot(control,x),"number of nodes for year effect Fishing mortality spline\n# 1=no spline (use one Fy for each year), >1 number of nodes","first year in each group",VPA.species)
} else wr.list(slot(control,x),"catch.spline.year",x)
},
"zero.catch.year.season"={if (nice) {
cat(sepLine,file=file,append=T)
cat("## year season combinations with zero catch (F=0) (option zero.catch.year.season)\n",
"# 0=no, all year-seasons have catchs,\n",
"# 1=yes there are year-season combinations with no catch.\n",
"# Read from file zero_catch_seasons_ages.in\n",
"# default=0\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"zero.catch.season.age"={if (nice) {
cat(sepLine,file=file,append=T)
cat("## season age combinations with zero catch (F=0) (option zero.catch.season.ages)\n",
"# 0=no, all seasons have catchs,\n",
"# 1=yes there are seasons with no catch. Read from file zero_catch_season_ages.in\n",
"# default=0\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"fix.F.factor" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## Factor for fixing last season effect in F-model (default=1) (fix.F.factor))\n",
file=file,append=T,sep="")
if (expand) wr.vector.expand(slot(control,x),VPA.species) else wr.vector.nice(slot(control,x),VPA.species)
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"est.calc.sigma" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## Uncertainties for catch, CPUE and SSB-R observations (option calc.est.sigma)\n",
"# values: 0=estimate sigma as a parameter (the right way of doing it)\n",
"# 1=Calculate sigma and truncate if lower limit is reached \n",
"# 2=Calculate sigma and use a penalty function to avoid lower limit \n",
"# catch-observation, CPUE-obs, Stock/recruit\n",
file=file,append=T,sep="")
cat(formatC(slot(control,x),width=12),"\n",file=file,append=T,sep=" ")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"read.HCR" = {if (nice) {
cat(sepLine,file=file,append=T)
cat("# Read HCR_option file (option=read.HCR) default=0 \n",
"# 0=no 1=yes\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
if (!write.multi) break
},
"incl.stom.all" = {if (nice) {
cat(sepLine,file=file,append=T)
cat("#\n#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&\n#\n",
"# multispecies parameters\n#\n",
"#&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&\n#\n",
file=file,append=TRUE,sep='')
cat("# Exclude year, season and predator combinations where stomach data are not incl.(option incl.stom.all)\n",
"# 0=no, all stomach data are used in likelihood\n",
"# 1=yes there are combinations for which data are not included in the likelihood.\n",
"# Read from file: incl_stom.in\n",
"# default(0)\n",
slot(control,x),"\n",file=file,append=T,sep="")
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"use.Nbar" = { if (nice) {
cat(sepLine,file=file,append=TRUE)
cat("## N in the beginning of the period or N bar for calculation of M2 (option use.Nbar)\n",
"# 0=use N in the beginning of the time step (default)\n",
"# 1=use N bar\n",
slot(control,x),"\n",file=file,append=T,sep="")
}
else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"M2.iterations" = {if (nice) {
cat(sepLine,file=file,append=TRUE)
cat("## Maximum M2 iterations (option M2.iterations) in case of use.Nbar=1\n",
slot(control,x),"\n",file=file,append=T,sep="")
}
else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"max.M2.sum2" = {if (nice) {
cat(sepLine,file=file,append=TRUE)
cat("## convergence criteria (option max.M2.sum2) in case of use.Nbar=1\n",
"# use max.M2.sum2=0.0 and M2.iterations=7 (or another high number) to make Hessian\n",
slot(control,x),"\n",file=file,append=T,sep="")
}
else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"stom.likelihood" = {if (nice) {
cat(sepLine,file=file,append=TRUE)
cat("## likelihood model for stomach content observations (option stom.likelihood)\n",
"# 1 =likelihood from prey weight proportions only (see option below)\n",
"# 2 =likelihood from prey weight proportions and from prey numbers to estimate size selection\n",
"# 3 =Gamma distribution for prey absolute weight and size selection from prey numbers\n",
slot(control,x),"\n",file=file,append=T,sep="")
}
else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"stomach.variance" = {if (nice) {
cat(sepLine,file=file,append=TRUE)
cat("# Variance used in likelihood model for stomach contents as prey weight proportion (option stomach.variance)\n",
"# 0 =not relevant, \n",
"# 1 =log normal distribution, \n",
"# 2 =normal distribution,\n",
"# 3 =Dirichlet distribution\n",
slot(control,x),"\n",file=file,append=T,sep="")
}
else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"simple.ALK" = {if (nice) {
cat(sepLine,file=file,append=TRUE)
cat("## Usage of age-length-keys for calc of M2 (option simple.ALK))\n",
"# 0=Use only one size group per age (file lsea.in or west.in)\n",
"# 1=Use size distribution per age (file ALK_all.in)\n",
slot(control,x),"\n",file=file,append=T,sep="")
}
else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"consum" = {if (nice) {
cat(sepLine,file=file,append=TRUE)
cat("## Usage of food-rations from input values or from size and regression parameters (option consum)\n",
"# 0=Use input values by age (file consum.in)\n",
"# 1=use weight at age (file west.in) and regression parameters (file consum_ab.in)\n",
"# 2=use length at age (file lsea.in), l-w relation and regression parameters (file consum_ab.in)\n",
slot(control,x),"\n",file=file,append=T,sep="")
}
else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"size.select.model" ={if (nice) {
cat(sepLine,file=file,append=TRUE)
cat("## Size selection model based on (option size.select.model)\n",
"# 1=length:\n",
"# M2 calculation:\n",
"# Size preference:\n",
"# Predator length at age from file: lsea.in\n",
"# Prey length at age from file: lsea.in\n",
"# Prey mean weight is weight in the sea from file: west.in\n",
"# Likelihood:\n",
"# Size preference:\n",
"# Predator mean length per length group (file: stom_pred_length_at_sizecl.in) \n",
"# Prey mean length per ength group (file stomlen_at_length.in \n",
"# Prey mean weight from mean weight per prey length group (file: stomweight_at_length.in \n",
"# 2=weight:\n",
"# M2 calculation:\n",
"# Size preference:\n",
"# Predator weight at age from file: west.in\n",
"# Prey weight at age from file: west.in\n",
"# Prey mean weight is weight in the sea from file: west.in\n",
"# Likelihood:\n",
"# Size preference\n",
"# Predator mean weight is based on mean length per predator length group (file: stom_pred_length_at_sizecl.in)\n",
"# and l-w relation (file: length_weight_relations.in), \n",
"# Prey mean weight per prey length group (file: stomweight_at_length.in) \n",
"# Prey mean weight from mean weight per prey length group (file: stomweight_at_length.in \n",file=file,append=T,sep="")
cat("# 3=weight:\n",
"# M2 calculation: Same as option 2\n",
"# Likelihood:\n",
"# Size preference:\n",
"# Predator mean weight is based on mean length per predator length group (file: stom_pred_length_at_sizecl.in)\n",
"# and l-w relation (file: length_weight_relations.in), \n",
"# Prey mean weight per prey length group (file: stomlen_at_length.in) and l-w relation (file:length_weight_relations.in)\n",
"# Prey mean weight from prey mean length per prey length group (file: stomlen_at_length.in) and l-w relation (file: length_weight_relations.in) \n",
"# 4=weight:\n",
"# M2 calculation:\n",
"# Size preference:\n",
"# Predator mean weight from file lsea.in (length in the sea) and l-w relation (file: length_weight_relations.in) \n",
"# Prey mean weight from file lsea.in (length in the sea) and l-w relation (file: length_weight_relations.in) \n",
"# Likelihood: Same as option 3\n",
"# 5=weight in combination with simple.ALK=1:\n",
"# M2 calculation:\n",
"# Size preference:\n",
"# Predator weight based on length from file ALK_all.in (length distribution at age) and l-w relation (file: length_weight_relations.in) \n",
"# Prey weight based on length from file ALK_all.in (length distribution at age) and l-w relation (file: length_weight_relations.in) \n",
"# Prey mean weight based on length from file ALK_all.in (length distribution at age) and l-w relation (file: length_weight_relations.in) \n",
"# Likelihood: Same as for option 2\n",
"# 6=weight in combination with simple.ALK=1:\n",
"# M2 calculation: Same as option 5\n",
"# Likelihood: Same as option 3\n",
slot(control,x),"\n",file=file,append=T,sep="")
}
else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"L50.mesh" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("# Adjust Length at Age distribution by a mesh selection function (option L50.mesh)\n",
"# Please note that options simple.ALK shoud be 1 and option size.select.model should be 5\n",
"# L50 (mm) is optional given as input. Selection Range is estimated by the model\n",
"# L50= -1 do not adjust\n",
"# L50=0, estimate L50 and selection range\n",
"# L50>0, input L50 (mm) and estimate selection range\n",
"# by VPA species\n",
file=file,append=T,sep="")
if (expand) wr.vector.expand(slot(control,x),VPA.species) else wr.vector.nice(slot(control,x),VPA.species)
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"size.selection" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## spread of size selection (option size.selection)\n",
"# 0=no size selection, predator/preys size range defined from observations\n",
"# 1=normal distribution size selection\n",
"# 3=Gamma distribution size distribution\n",
"# 4=no size selection, but range defined by input min and max regression parameters (file pred_prey_size_range_param.in)\n",
"# 5=Beta distributed size distribution, within observed size range\n",
"# 6=log-Beta size distributed, within observed size range\n",
"#\n",
"# by predator\n",
file=file,append=T,sep="")
if (expand) wr.vector.expand(slot(control,x),pred.species) else wr.vector.nice(slot(control,x),pred.species)
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"sum.stom.like" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## sum stomach contents over prey size for use in likelihood for prey weight proportions (option sum.stom.like)\n",
"# 0=no, use observations as they are; 1=yes, sum observed and predicted stomach contents before used in likelihood for prey weight proportions\n",
"#\n",
"# by predator\n",
file=file,append=T,sep="")
if (expand) wr.vector.expand(slot(control,x),pred.species) else wr.vector.nice(slot(control,x),pred.species)
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"stom.obs.var" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## # Use estimated scaling factor to link number of observation to variance for stomach observation likelihood (option stom_obs_var)\n",
"# 0=no, do not estiamte factor (assumed=1); 1=yes, estimate the factor; 2=equal weight (1) for all samples\n",
"#\n",
"# by predator\n",
file=file,append=T,sep="")
if (expand) wr.vector.expand(slot(control,x),pred.species) else wr.vector.nice(slot(control,x),pred.species)
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"stom.max.sumP" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## # Upper limit for Dirichlet sumP. A low value (e.g. 10) limits the risk of overfitting. A high value (e.g. 100) allows a full fit. (option stom_max_sumP)\n",
"# by predator\n",
file=file,append=T,sep="")
if (expand) wr.vector.expand(slot(control,x),pred.species) else wr.vector.nice(slot(control,x),pred.species)
} else cat(slot(control,x),"\t#",x,"\n",file=file,append=TRUE)
},
"var.scale.stom" ={if (nice) {
cat(sepLine,file=file,append=T)
cat("## Scaling factor (to bring parameters close to one) for relation between no of stomachs sampling and variance\n",
"# value=0: use default values i.e. 1.00 for no size selection and otherwise 0.1 (option var.scale.stom)\n",
file=file,append=T,sep="")