@@ -6,8 +6,10 @@ forecasters <- tibble::tribble(
66 ~ forecaster , ~ extra_params , ~ extra_params_names , ~ fc_name ,
77 scaled_pop , list (1 , TRUE ), list (" ahead" , " pop_scaling" ), " scaled_pop" ,
88 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"
1011)
12+ expects_nonequal <- c(" scaled_pop" , " smoothed_scaled" )
1113synth_mean <- 25
1214synth_sd <- 2
1315tiny_sd <- 1.0e-5
@@ -49,7 +51,7 @@ different_constants <- epiprocess::as_epi_archive(rbind(
4951))
5052for (ii in 1 : nrow(forecasters )) {
5153 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 ) ) {
5355 suppressWarnings(expect_warning(res <- get_pred(different_constants , ii ), regexp = " prediction from rank-deficient fit" ))
5456 } else {
5557 res <- get_pred(different_constants , ii )
@@ -126,7 +128,7 @@ missing_state <- epiprocess::as_epi_archive(rbind(
126128))
127129for (ii in seq_len(nrow(forecasters ))) {
128130 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 ) ) {
130132 suppressWarnings(expect_warning(res <- get_pred(missing_state , ii ), regexp = " prediction from rank-deficient fit" ))
131133 } else {
132134 res <- get_pred(missing_state , ii )
@@ -171,7 +173,7 @@ for (ii in seq_len(nrow(forecasters))) {
171173 test_that(paste(forecasters $ fc_name [[ii ]], " predicts a linear increasing slope correctly" ), {
172174 # flatline will definitely fail this, so it's exempt
173175 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 ) ) {
175177 suppressWarnings(expect_warning(res <- get_pred(linear , ii ), regexp = " prediction from rank-deficient fit" ))
176178 } else {
177179 res <- get_pred(linear , ii )
0 commit comments