-
Notifications
You must be signed in to change notification settings - Fork 3
/
301 - Writing your own functions for mp() - handson.R
101 lines (73 loc) · 3.1 KB
/
301 - Writing your own functions for mp() - 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
88
89
90
91
92
93
94
95
#####################################################################
# MSE Course
# Writing your own functions for mp() (session 01, 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)
#====================================================================
# API
#====================================================================
#--------------------------------------------------------------------
# foo function
#--------------------------------------------------------------------
foo <- function(...){
browser()
# args <- list(...)
# names(args)
}
#--------------------------------------------------------------------
# estimator (est)
#--------------------------------------------------------------------
ctrl <- mpCtrl(list(est = mseCtrl(method=foo)))
mp(stk.om, oem, iem, ctrl=ctrl, args=mpargs)
#--------------------------------------------------------------------
# parametrization of the HCR (phcr)
#--------------------------------------------------------------------
ctrl <- mpCtrl(list(phcr = mseCtrl(method=foo)))
mp(stk.om, oem, iem, ctrl=ctrl, args=mpargs)
#--------------------------------------------------------------------
# HCR (hcr)
#--------------------------------------------------------------------
ctrl <- mpCtrl(list(hcr = mseCtrl(method=foo)))
mp(stk.om, oem, iem, ctrl=ctrl, args=mpargs)
#--------------------------------------------------------------------
# implementation system (is)
#--------------------------------------------------------------------
ctrl <- mpCtrl(list(isys = mseCtrl(method=foo)))
mp(stk.om, oem, iem, ctrl=ctrl, args=mpargs)
#--------------------------------------------------------------------
# technical measures (tm)
#--------------------------------------------------------------------
ctrl <- mpCtrl(list(tm = mseCtrl(method=foo)))
mp(stk.om, oem, iem, ctrl=ctrl, args=mpargs)
#--------------------------------------------------------------------
# OM projections
#--------------------------------------------------------------------
stk.om2 <- stk.om
projection(stk.om2) <- mseCtrl(method=foo)
mp(stk.om2, oem, iem, ctrl=mpCtrl(), args=mpargs)
#--------------------------------------------------------------------
# OEM
#--------------------------------------------------------------------
oem2 <- oem
method(oem2) <- foo
mp(stk.om, oem2, iem, ctrl=mpCtrl(), args=mpargs)
#--------------------------------------------------------------------
# IEM
#--------------------------------------------------------------------
iem2 <- iem
method(iem2) <- foo
mp(stk.om, oem, iem2, ctrl=mpCtrl(), args=mpargs)