@@ -6,8 +6,10 @@ forecasters <- tibble::tribble(
6
6
~ forecaster , ~ extra_params , ~ extra_params_names , ~ fc_name ,
7
7
scaled_pop , list (1 , TRUE ), list (" ahead" , " pop_scaling" ), " scaled_pop" ,
8
8
scaled_pop , list (1 , FALSE ), list (" ahead" , " pop_scaling" ), " scaled_pop" ,
9
- flatline_fc , list (1 ), list (" ahead" ), " flatline_fc"
9
+ flatline_fc , list (1 ), list (" ahead" ), " flatline_fc" ,
10
+ smoothed_scaled , list (1 ), list (" ahead" ), " smoothed_scaled"
10
11
)
12
+ expects_nonequal <- c(" scaled_pop" , " smoothed_scaled" )
11
13
synth_mean <- 25
12
14
synth_sd <- 2
13
15
tiny_sd <- 1.0e-5
@@ -49,7 +51,7 @@ different_constants <- epiprocess::as_epi_archive(rbind(
49
51
))
50
52
for (ii in 1 : nrow(forecasters )) {
51
53
test_that(paste(forecasters $ fc_name [[ii ]], " predicts a constant median for constant data" ), {
52
- if (forecasters $ fc_name [[ii ]] == " scaled_pop " ) {
54
+ if (any( forecasters $ fc_name [[ii ]] %in% expects_nonequal ) ) {
53
55
suppressWarnings(expect_warning(res <- get_pred(different_constants , ii ), regexp = " prediction from rank-deficient fit" ))
54
56
} else {
55
57
res <- get_pred(different_constants , ii )
@@ -126,7 +128,7 @@ missing_state <- epiprocess::as_epi_archive(rbind(
126
128
))
127
129
for (ii in seq_len(nrow(forecasters ))) {
128
130
test_that(paste(forecasters $ fc_name [[ii ]], " predicts well in the presence of only one state with variably delayed data" ), {
129
- if (forecasters $ fc_name [[ii ]] == " scaled_pop " ) {
131
+ if (any( forecasters $ fc_name [[ii ]] %in% expects_nonequal ) ) {
130
132
suppressWarnings(expect_warning(res <- get_pred(missing_state , ii ), regexp = " prediction from rank-deficient fit" ))
131
133
} else {
132
134
res <- get_pred(missing_state , ii )
@@ -171,7 +173,7 @@ for (ii in seq_len(nrow(forecasters))) {
171
173
test_that(paste(forecasters $ fc_name [[ii ]], " predicts a linear increasing slope correctly" ), {
172
174
# flatline will definitely fail this, so it's exempt
173
175
if (! identical(forecasters $ forecaster [[ii ]], flatline_fc )) {
174
- if (forecasters $ fc_name [[ii ]] == " scaled_pop " ) {
176
+ if (any( forecasters $ fc_name [[ii ]] %in% expects_nonequal ) ) {
175
177
suppressWarnings(expect_warning(res <- get_pred(linear , ii ), regexp = " prediction from rank-deficient fit" ))
176
178
} else {
177
179
res <- get_pred(linear , ii )
0 commit comments