-
Notifications
You must be signed in to change notification settings - Fork 3
/
303 - Estimator explained: stock status or trends - handson.R
88 lines (70 loc) · 2.93 KB
/
303 - Estimator explained: stock status or trends - handson.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
#####################################################################
# MSE Course
# Estimator explained hands-on (session 03, day03)
# 20191119 (EJ)
#####################################################################
#====================================================================
# libraries, code and input data
#====================================================================
library(FLa4a)
library(mse)
library(FLAssess)
library(ggplotFL)
library(FLBRP)
library(doParallel)
load("mse_setup.RData")
#--------------------------------------------------------------------
# generic arguments to be passed to the MP
#--------------------------------------------------------------------
mpargs <- list(fy=fy, y0=y0, iy=iy, nsqy=nsqy, seed = 1234)
#====================================================================
# estimators
#====================================================================
#--------------------------------------------------------------------
# estimator function skeleton
#--------------------------------------------------------------------
my.est <- function (stk, idx, args, tracking, ...){
browser()
# code that runs a stock assessment, creates a new stock object with the estimations and updates the tracking matrix
# output must have a stock object
list(stk = stk.est, tracking = tracking)
}
#--------------------------------------------------------------------
# run
#--------------------------------------------------------------------
ctrl <- mpCtrl(list(
est = mseCtrl(method=my.est),
phcr = mseCtrl(method=movingF.phcr, args=list(interval=5, frp='msy')),
hcr = mseCtrl(method=movingF.hcr),
isys = mseCtrl(method=tac.is)))
mp(stk.om, oem, iem, ctrl=ctrl, args=mpargs)
#====================================================================
# assignment
# groups of 3
# 1 coder, 1 raporteur, 1 modeler
#====================================================================
#--------------------------------------------------------------------
# (1)
# develop a biased assessment
# hint: simulate the stock assessment
#--------------------------------------------------------------------
#--------------------------------------------------------------------
# (2)
# develop a separable assessment
# hint: use a4a
#--------------------------------------------------------------------
#--------------------------------------------------------------------
# (3)
# develop a XSA assessment
# hint: aaarrrggghhhhhhhhh
#--------------------------------------------------------------------
#--------------------------------------------------------------------
# (4)
# develop a model ensemble assessment
# hint: use a4a fmodels
#--------------------------------------------------------------------
#--------------------------------------------------------------------
# (5)
# develop a production model assessment
# hint: will need to change the OEM and HCR also
#--------------------------------------------------------------------