Skip to content

Commit c0f3a70

Browse files
committed
add new tests
1 parent 5e49cae commit c0f3a70

6 files changed

Lines changed: 2044 additions & 34 deletions

File tree

R/revisions.R

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ get_revisions <- function(
348348
#' # Access the index of the first efficient release
349349
#' result$e
350350
#'
351-
#' @references Aruoba, S. Borağan, "Revisions Are Not Well Behaved", Journal of
351+
#' @references Aruoba, S. Boragan, "Revisions Are Not Well Behaved", Journal of
352352
#' Money, Credit and Banking, 40(2-3), 319-340, 2008.
353353
#'
354354
#' @family revision analysis
@@ -1225,15 +1225,15 @@ print.revision_summary <- function(x, interpretation = TRUE, digits = 3, ...) {
12251225
if (bias_p < 0.05) {
12261226
direction <- if (bias_mean > 0) "upward" else "downward"
12271227
cat(
1228-
" Significant",
1228+
" \u2022 Significant",
12291229
direction,
12301230
"bias detected (p =",
12311231
round(bias_p, 3),
12321232
")\n"
12331233
)
12341234
} else {
12351235
cat(
1236-
" No significant bias detected (p =",
1236+
" \u2022 No significant bias detected (p =",
12371237
round(bias_p, 3),
12381238
")\n"
12391239
)
@@ -1247,19 +1247,19 @@ print.revision_summary <- function(x, interpretation = TRUE, digits = 3, ...) {
12471247
if (!is.na(ns_ratio)) {
12481248
if (ns_ratio < 0.1) {
12491249
cat(
1250-
" Very low revision volatility (Noise/Signal =",
1250+
" \u2022 Very low revision volatility (Noise/Signal =",
12511251
round(ns_ratio, 3),
12521252
")\n"
12531253
)
12541254
} else if (ns_ratio < 0.3) {
12551255
cat(
1256-
" Moderate revision volatility (Noise/Signal =",
1256+
" \u2022 Moderate revision volatility (Noise/Signal =",
12571257
round(ns_ratio, 3),
12581258
")\n"
12591259
)
12601260
} else {
12611261
cat(
1262-
" High revision volatility (Noise/Signal =",
1262+
" \u2022 High revision volatility (Noise/Signal =",
12631263
round(ns_ratio, 3),
12641264
")\n"
12651265
)
@@ -1276,9 +1276,9 @@ print.revision_summary <- function(x, interpretation = TRUE, digits = 3, ...) {
12761276
if (cor_p < 0.05) {
12771277
direction <- if (cor_val > 0) "positive" else "negative"
12781278
cat(
1279-
" Significant",
1279+
" \u2022 Significant",
12801280
direction,
1281-
"correlation between revisions and initial values (ρ =",
1281+
"correlation between revisions and initial values (\u03C1 =",
12821282
round(cor_val, 3),
12831283
", p =",
12841284
round(cor_p, 3),
@@ -1294,13 +1294,13 @@ print.revision_summary <- function(x, interpretation = TRUE, digits = 3, ...) {
12941294
if (!is.na(news_p)) {
12951295
if (news_p < 0.05) {
12961296
cat(
1297-
" Revisions contain NEWS (p =",
1297+
" \u2022 Revisions contain NEWS (p =",
12981298
round(news_p, 3),
12991299
"): systematic information\n"
13001300
)
13011301
} else {
13021302
cat(
1303-
" Revisions do NOT contain news (p =",
1303+
" \u2022 Revisions do NOT contain news (p =",
13041304
round(news_p, 3),
13051305
")\n"
13061306
)
@@ -1313,13 +1313,13 @@ print.revision_summary <- function(x, interpretation = TRUE, digits = 3, ...) {
13131313
if (!is.na(noise_p)) {
13141314
if (noise_p < 0.05) {
13151315
cat(
1316-
" Revisions contain NOISE (p =",
1316+
" \u2022 Revisions contain NOISE (p =",
13171317
round(noise_p, 3),
13181318
"): measurement error\n"
13191319
)
13201320
} else {
13211321
cat(
1322-
" Revisions do NOT contain noise (p =",
1322+
" \u2022 Revisions do NOT contain noise (p =",
13231323
round(noise_p, 3),
13241324
")\n"
13251325
)
@@ -1335,8 +1335,8 @@ print.revision_summary <- function(x, interpretation = TRUE, digits = 3, ...) {
13351335
if (!is.na(auto_p) && !is.na(auto_val)) {
13361336
if (auto_p < 0.05) {
13371337
cat(
1338-
" Significant autocorrelation in revisions (ρ₁ =",
1339-
round(auto_val, 3),
1338+
" \u2022 Significant autocorrelation in revisions
1339+
(\u03C1\u2081 =", round(auto_val, 3),
13401340
"): revisions are persistent\n"
13411341
)
13421342
}
@@ -1348,15 +1348,15 @@ print.revision_summary <- function(x, interpretation = TRUE, digits = 3, ...) {
13481348
u1 <- row[["Theil's U1"]]
13491349
if (!is.na(u1)) {
13501350
if (u1 < 0.3) {
1351-
cat(" Good forecast accuracy (Theil's U1 =", round(u1, 3), ")\n")
1351+
cat(" \u2022 Good forecast accuracy (Theil's U1 =", round(u1, 3), ")\n")
13521352
} else if (u1 < 0.6) {
13531353
cat(
1354-
" Moderate forecast accuracy (Theil's U1 =",
1354+
" \u2022 Moderate forecast accuracy (Theil's U1 =",
13551355
round(u1, 3),
13561356
")\n"
13571357
)
13581358
} else {
1359-
cat(" Poor forecast accuracy (Theil's U1 =", round(u1, 3), ")\n")
1359+
cat(" \u2022 Poor forecast accuracy (Theil's U1 =", round(u1, 3), ")\n")
13601360
}
13611361
}
13621362
}
@@ -1368,15 +1368,15 @@ print.revision_summary <- function(x, interpretation = TRUE, digits = 3, ...) {
13681368
pct <- round(sign_correct * 100, 1)
13691369
if (pct > 90) {
13701370
cat(
1371-
" Excellent sign prediction (",
1371+
" \u2022 Excellent sign prediction (",
13721372
pct,
13731373
"% correct)\n",
13741374
sep = ""
13751375
)
13761376
} else if (pct > 70) {
1377-
cat(" Good sign prediction (", pct, "% correct)\n", sep = "")
1377+
cat(" \u2022 Good sign prediction (", pct, "% correct)\n", sep = "")
13781378
} else {
1379-
cat(" Poor sign prediction (", pct, "% correct)\n", sep = "")
1379+
cat(" \u2022 Poor sign prediction (", pct, "% correct)\n", sep = "")
13801380
}
13811381
}
13821382
}
@@ -1476,8 +1476,8 @@ diagnose.revision_summary <- function(object, alpha = 0.05, ...) {
14761476
bias_mean <- row[["Bias (mean)"]]
14771477

14781478
if (!is.na(bias_p)) {
1479-
status <- if (bias_p >= alpha) " PASS" else " FAIL"
1480-
value <- paste0("p=", round(bias_p, 3), ", μ=", round(bias_mean, 3))
1479+
status <- if (bias_p >= alpha) "\u2713 PASS" else "\u2717 FAIL"
1480+
value <- paste0("p=", round(bias_p, 3), ", \u03BC=", round(bias_mean, 3))
14811481
assessment <- if (bias_p >= alpha) {
14821482
"No significant bias"
14831483
} else {
@@ -1506,11 +1506,11 @@ diagnose.revision_summary <- function(object, alpha = 0.05, ...) {
15061506

15071507
if (!is.na(ns)) {
15081508
status <- if (ns < 0.3) {
1509-
" GOOD"
1509+
"\u2713 GOOD"
15101510
} else if (ns < 0.5) {
15111511
"~ OK"
15121512
} else {
1513-
" HIGH"
1513+
"\u2717 HIGH"
15141514
}
15151515
value <- round(ns, 3)
15161516
assessment <- if (ns < 0.3) {
@@ -1538,7 +1538,7 @@ diagnose.revision_summary <- function(object, alpha = 0.05, ...) {
15381538
news_p <- row[["News joint test (p-value)"]]
15391539

15401540
if (!is.na(news_p)) {
1541-
status <- if (news_p >= alpha) " PASS" else " FAIL"
1541+
status <- if (news_p >= alpha) "\u2713 PASS" else "\u2717 FAIL"
15421542
value <- paste0("p=", round(news_p, 3))
15431543
assessment <- if (news_p >= alpha) {
15441544
"No news component"
@@ -1563,7 +1563,7 @@ diagnose.revision_summary <- function(object, alpha = 0.05, ...) {
15631563
noise_p <- row[["Noise joint test (p-value)"]]
15641564

15651565
if (!is.na(noise_p)) {
1566-
status <- if (noise_p >= alpha) " PASS" else " FAIL"
1566+
status <- if (noise_p >= alpha) "\u2713 PASS" else "\u2717 FAIL"
15671567
value <- paste0("p=", round(noise_p, 3))
15681568
assessment <- if (noise_p >= alpha) {
15691569
"No noise component"
@@ -1589,11 +1589,11 @@ diagnose.revision_summary <- function(object, alpha = 0.05, ...) {
15891589

15901590
if (!is.na(u1)) {
15911591
status <- if (u1 < 0.3) {
1592-
" GOOD"
1592+
"\u2713 GOOD"
15931593
} else if (u1 < 0.6) {
15941594
"~ OK"
15951595
} else {
1596-
" POOR"
1596+
"\u2717 POOR"
15971597
}
15981598
value <- round(u1, 3)
15991599
assessment <- if (u1 < 0.3) {
@@ -1622,11 +1622,11 @@ diagnose.revision_summary <- function(object, alpha = 0.05, ...) {
16221622

16231623
if (!is.na(sign_pct)) {
16241624
status <- if (sign_pct > 90) {
1625-
" GOOD"
1625+
"\u2713 GOOD"
16261626
} else if (sign_pct > 70) {
16271627
"~ OK"
16281628
} else {
1629-
" POOR"
1629+
"\u2717 POOR"
16301630
}
16311631
value <- paste0(round(sign_pct, 1), "%")
16321632
assessment <- if (sign_pct > 90) {
@@ -1680,11 +1680,11 @@ diagnose.revision_summary <- function(object, alpha = 0.05, ...) {
16801680
)
16811681

16821682
if (pct_pass >= 80) {
1683-
cat("Overall: GOOD - Revisions are of high quality\n")
1683+
cat("Overall: \u2713 GOOD - Revisions are of high quality\n")
16841684
} else if (pct_pass >= 60) {
16851685
cat("Overall: ~ MODERATE - Some revision quality issues detected\n")
16861686
} else {
1687-
cat("Overall: POOR - Significant revision quality issues\n")
1687+
cat("Overall: \u2717 POOR - Significant revision quality issues\n")
16881688
}
16891689
}
16901690

R/utils.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,11 @@ make_explicit_missing <- function(
681681
)
682682
names(complete_dates) <- time_col
683683

684-
data_subset <- data %>% dplyr::select(c(time_col, dplyr::everything()))
684+
data_subset <- data %>%
685+
dplyr::select(
686+
dplyr::all_of(time_col),
687+
dplyr::everything()
688+
)
685689

686690
# Merge to create explicit NAs
687691
complete_data <- complete_dates %>%

man/get_first_efficient_release.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)