@@ -11,11 +11,11 @@ test_that("get_index works", {
11
11
)
12
12
nd <- replicate_df(qcs_grid , " year" , unique(pcod $ year ))
13
13
predictions <- predict(m , newdata = nd , return_tmb_object = TRUE )
14
- ind <- get_index(predictions )
14
+ ind <- get_index(predictions , bias_correct = FALSE )
15
15
ind
16
16
expect_s3_class(ind , " data.frame" )
17
17
18
- indsp <- get_index_split(m , nd , nsplit = 2 )
18
+ indsp <- get_index_split(m , nd , nsplit = 2 , bias_correct = FALSE )
19
19
expect_equal(ind , indsp )
20
20
expect_identical(chunk_time(c(1 , 2 , 3 ), 2 ), list (`1` = c(1 , 2 ), `2` = 3 ))
21
21
expect_error(chunk_time(c(1 , 2 ), 0 ))
@@ -40,8 +40,8 @@ test_that("get_index works", {
40
40
# splits work with areas:
41
41
set.seed(1 )
42
42
areas <- rlnorm(nrow(nd ), meanlog = 0 , sdlog = 0.1 )
43
- ind <- get_index(predictions , area = areas )
44
- indsp <- get_index_split(m , nd , nsplit = 2 , area = areas )
43
+ ind <- get_index(predictions , area = areas , bias_correct = FALSE )
44
+ indsp <- get_index_split(m , nd , nsplit = 2 , area = areas , bias_correct = FALSE )
45
45
expect_equal(ind , indsp )
46
46
47
47
# splits work with offsets:
@@ -57,8 +57,8 @@ test_that("get_index works", {
57
57
set.seed(1 )
58
58
fake_offset <- rnorm(nrow(nd2 ), 0 , 0.1 )
59
59
predictions2 <- predict(m2 , newdata = nd2 , return_tmb_object = TRUE , offset = fake_offset )
60
- ind <- get_index(predictions2 )
61
- indsp <- get_index_split(m2 , nd2 , nsplit = 2 , predict_args = list (offset = fake_offset ))
60
+ ind <- get_index(predictions2 , bias_correct = FALSE )
61
+ indsp <- get_index_split(m2 , nd2 , nsplit = 2 , predict_args = list (offset = fake_offset ), bias_correct = FALSE )
62
62
expect_equal(ind , indsp )
63
63
})
64
64
@@ -130,13 +130,13 @@ test_that("Index integration with area vector works with extra time and possibly
130
130
nd <- replicate_df(qcs_grid , " year" , seq(2011 , 2017 ))
131
131
nd $ area <- 4
132
132
p <- predict(fit , newdata = nd , return_tmb_object = TRUE )
133
- ind0 <- get_index(p , area = nd $ area )
133
+ ind0 <- get_index(p , area = nd $ area , bias_correct = FALSE )
134
134
135
135
# newdata doesn't have all fitted years:
136
136
nd <- replicate_df(qcs_grid , " year" , unique(pcod_2011 $ year ))
137
137
nd $ area <- 4
138
138
p <- predict(fit , newdata = nd , return_tmb_object = TRUE )
139
- ind <- get_index(p , area = nd $ area )
139
+ ind <- get_index(p , area = nd $ area , bias_correct = FALSE )
140
140
if (FALSE ) {
141
141
library(ggplot2 )
142
142
ggplot(ind , aes(year , est , ymin = lwr , ymax = upr )) + geom_pointrange() +
@@ -165,9 +165,9 @@ test_that("get_index works", {
165
165
predictions <- predict(m , newdata = nd , return_tmb_object = TRUE )
166
166
167
167
# get predictions with area passed as vector
168
- ind <- get_index(predictions , area = nd $ area )
168
+ ind <- get_index(predictions , area = nd $ area , bias_correct = FALSE )
169
169
# get predictions with area as a named column
170
- ind2 <- get_index(predictions , area = " area" )
170
+ ind2 <- get_index(predictions , area = " area" , bias_correct = FALSE )
171
171
expect_equal(ind , ind2 )
172
172
173
173
# get predictions with area passed as vector
0 commit comments