-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpreditTests2.R
More file actions
58 lines (42 loc) · 1.6 KB
/
Copy pathpreditTests2.R
File metadata and controls
58 lines (42 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
vmodel <- list(~1, ~1)
qmodel=list(~s(age, k=4))
fit <- a4aSCA(ple4, FLIndices(ple4.index), fit="assessment", vmodel=vmodel, qmodel=qmodel)
qmod <- qmodel(pars(fit))[[1]]
qmod@centering
stkmod <- stkmodel(pars(fit))
qmod@centering <- qmod@centering-stkmod@centering
predict(qmod)
sfrac <- mean(range(ple4.index)[c("startf", "endf")])
Z <- (m(ple4) + harvest(fit2))*sfrac
lst <- dimnames(fit2@index[[1]])
lst$x <- stock.n(fit2)*exp(-Z)
stkn <- do.call("trim", lst)
qhat <- index(fit2)[[1]]/stkn
all.equal(c(qhat), c(predict(qmod2)))
vmodel <- list(~1, ~1)
qmodel=list(~s(age, k=4))
fit2 <- FLa4a:::a4aInternal(stock=ple4, indices=FLIndices(ple4.index), fit="assessment", vmodel=vmodel, qmodel=qmodel, center=FALSE)
qmod2 <- qmodel(pars(fit2))[[1]]
qmod2@centering
stkmod2 <- stkmodel(pars(fit2))
qmod2@centering <- qmod2@centering-stkmod2@centering
predict(qmod2)
all.equal(predict(qmod2), predict(qmod))
sfrac <- mean(range(ple4.index)[c("startf", "endf")])
Z <- (m(ple4) + harvest(fit2))*sfrac
lst <- dimnames(fit2@index[[1]])
lst$x <- stock.n(fit2)*exp(-Z)
stkn <- do.call("trim", lst)
qhat <- index(fit2)[[1]]/stkn
all.equal(c(qhat), c(predict(qmod2)))
vmodel <- list(~1, ~1)
qmodel=list(~s(age, k=4))
fit2 <- FLa4a:::a4aInternal(stock=ple4, indices=FLIndices(ple4.index), fit="assessment", vmodel=vmodel, qmodel=qmodel, center=FALSE)
qmod2 <- qmodel(pars(fit2))[[1]]
sfrac <- mean(range(ple4.index)[c("startf", "endf")])
Z <- (m(ple4) + harvest(fit2))*sfrac
lst <- dimnames(fit2@index[[1]])
lst$x <- stock.n(fit2)*exp(-Z)
stkn <- do.call("trim", lst)
qhat <- index(fit2)[[1]]/stkn
all.equal(c(qhat), c(predict(qmod2)))