GithubHelp home page GithubHelp logo

tylerjpike / sovereign Goto Github PK

View Code? Open in Web Editor NEW
11.0 1.0 3.0 8.02 MB

State-Dependent Empirical Analysis: tools for state-dependent forecasts, impulse response functions, historical decomposition, and forecast error variance decomposition.

License: GNU General Public License v3.0

R 100.00%
state-dependent macroeconomics econometrics impulse-response forecasting vector-autoregression time-series r local-projection

sovereign's Introduction

Tyler J. Pike

Research Interests

  1. Macroeconomics: Macro-Finance, Monetary Policy, Firm Dynamics
  2. Econometrics: Non-linear statistics and machine learning, time series analysis and macroeconometrics

Research Background

  1. University of Maryland
    current position
    • PhD student in economics
    • Research Assistant to John Haltiwanger
  2. Federal Reserve Board
    • Research Assistant to Vice Chair Clarida
    • Research Assistant to Macro-Financial Anlaysis Section
  3. University of Richmond
    • BS in Mathematical Economics
    • Economics Research Assistant and Research Fellow

Selected Research Code

  1. "Combining forecasts: Can machines beat the average?"
    with Francisco Vazquez-Grande, September 2020
    Github | Working Paper

  2. "Bottom-up leading macroeconomic indicators: An application to non-financial corporate defaults using machine learning"
    with Horacio Sapriza, and Tom Zimmermann, September 2019
    Github | Working Paper

Statistical Software Packages

  1. OOS for out-of-sample time series forecasting
    Github | Website | CRAN

  2. sovereign for state-dependent empirical analysis
    Github | Website | CRAN


Github badge Github badge Github badge Linkedin Badge Website Gmail Badge

sovereign's People

Contributors

tylerjpike avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

sovereign's Issues

IV Estimation not Working?

Hi, thanks for the effot in creating this package. I tried to estimate a VAR using an instrument. However, coefficient estimates are exactly the same, whether I include the instrument or run a standard VAR. Checking the source code I have noticed that in the VAR_estimation.R function, instrument is a possible input but it does not seem to appear anywhere inside the function.

Potentially I am missing something - but, as of now, does the external instrument identification work? Thanks!

Question for Wild Bootstrapping

Hello! First, thank you for making great packages!

However, I have some questions for Wild Bootstrapping

In your source code, the quantile of confidence interval is not just original quantile value, but added adjusted values

Like below....
########
(response.adjust = response - response.mean, response.lower = response.lower + response.adjust, response.upper = response.upper + response.adjust)

What my question is in the bootstrapping, is it okay to add this adjusted value?

Thank you!

R CMD check: caught segfault: address 0x4, cause 'memory not mapped' [in vignette]

Hi, I'm running revdep checks on future and spotted that sovereign might suffer from some memory leak or similar, cf. https://github.com/HenrikBengtsson/future/blob/584acb7cc90a18e2e2d1fda20ced9c45392df28c/revdep/R_FUTURE_DEPRECATED_DEFUNCT%3Dremote%2Ctransparent/problems.md#sovereign.

Since you don't use native code in your package, it might be due to one of your dependencies. See below for the full output. This happens very sporadically. I just reran my revdep checks on sovereign and then there were no issues, cf. https://github.com/HenrikBengtsson/future/blob/610d17e971df8a158c33ab920130f46323d9cad1/revdep/R_FUTURE_DEPRECATED_DEFUNCT%3Dremote%2Ctransparent/README.md.

Either way, I figured you might wanna know because this might happen on CRAN too, and to some of your users. It might also be useful clue to maintainers of your package dependencies for their troubleshooting.

* using log directory/c4/home/henrik/repositories/future/revdep/checks/sovereign/new/sovereign.Rcheck* using R version 4.1.3 (2022-03-10)
* using platform: x86_64-pc-linux-gnu (64-bit)
* using session charset: UTF-8
* using option--no-manual* checking for filesovereign/DESCRIPTION... OK
* this is packagesovereignversion1.2.1* package encoding: UTF-8
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... OK
* checking if there is a namespace ... OK
* checking for executable files ... OK
* checking for hidden files and directories ... OK
* checking for portable file names ... OK
* checking for sufficient/correct file permissions ... OK
* checking whether packagesovereigncan be installed ... OK
* checking installed package size ... OK
* checking package directory ... OK
* checkingbuilddirectory ... OK
* checking DESCRIPTION meta-information ... OK
* checking top-level files ... OK
* checking for left-over files ... OK
* checking index information ... OK
* checking package subdirectories ... OK
* checking R files for non-ASCII characters ... OK
* checking R files for syntax errors ... OK
* checking whether the package can be loaded ... OK
* checking whether the package can be loaded with stated dependencies ... OK
* checking whether the package can be unloaded cleanly ... OK
* checking whether the namespace can be loaded with stated dependencies ... OK
* checking whether the namespace can be unloaded cleanly ... OK
* checking loading without being on the library search path ... OK
* checking dependencies in R code ... OK
* checking S3 generic/method consistency ... OK
* checking replacement functions ... OK
* checking foreign function calls ... OK
* checking R code for possible problems ... OK
* checking Rd files ... OK
* checking Rd metadata ... OK
* checking Rd cross-references ... OK
* checking for missing documentation entries ... OK
* checking for code/documentation mismatches ... OK
* checking Rd \usage sections ... OK
* checking Rd contents ... OK
* checking for unstated dependencies in examples ... OK
* checking installed files frominst/doc... OK
* checking files invignettes... OK
* checking examples ... OK
* checking for unstated dependencies intests... OK
* checking tests ... OK
  Runningtestthat.R* checking for unstated dependencies in vignettes ... OK
* checking package vignettes ininst/doc... OK
* checking running R code from vignettes ... NONEgetting_started.RmdusingUTF-8... OK
* checking re-building of vignette outputs ... WARNING
Error(s) in re-building vignettes:
--- re-buildinggetting_started.Rmdusing rmarkdown
`summarise()` has grouped output by 'y'. You can override using the `.groups`
argument.
Warning: Removed 1 row(s) containing missing values (geom_path).
Warning: Removed 1 row(s) containing missing values (geom_path).
Warning: Removed 1 row(s) containing missing values (geom_path).
Warning: Removed 1 row(s) containing missing values (geom_path).
Warning: Removed 1 row(s) containing missing values (geom_path).
Warning: Removed 1 row(s) containing missing values (geom_path).
Warning: Removed 3 rows containing missing values (position_stack).
Warning: Removed 3 row(s) containing missing values (geom_path).
Warning: Removed 3 rows containing missing values (position_stack).
Warning: Removed 3 row(s) containing missing values (geom_path).
Warning: Removed 3 rows containing missing values (position_stack).
Warning: Removed 3 row(s) containing missing values (geom_path).

 *** caught segfault ***
address 0x4, cause 'memory not mapped'
*** recursive gc invocation
*** recursive gc invocation
*** recursive gc invocation
*** recursive gc invocation
*** recursive gc invocation
*** recursive gc invocation
*** recursive gc invocation
... [ ~ 2000 more of these ] ...
*** recursive gc invocation
*** recursive gc invocation

Traceback:
 1: as.data.frame(x[[i]], optional = TRUE)
 2: (function (..., row.names = NULL, check.rows = FALSE, check.names = TRUE,     fix.empty.names = TRUE, stringsAsFactors = FALSE) {    data.r
ow.names <- if (check.rows && is.null(row.names))         function(current, new, i) {            if (is.character(current))                 new
 <- as.character(new)            if (is.character(new))                 current <- as.character(current)            if (anyDuplicated(new))    
             return(current)            if (is.null(current))                 return(new)            if (all(current == new) || all(current == 
""))                 return(new)            stop(gettextf("mismatch of row names in arguments of 'data.frame', item %d",                 i), do
main = NA)        }    else function(current, new, i) {        if (is.null(current)) {            if (anyDuplicated(new)) {                warn
ing(gettextf("some row.names duplicated: %s --> row.names NOT used",                   paste(which(duplicated(new)), collapse = ",")),         
          domain = NA)                current            }            else new        }        else current    }    object <- as.list(substitut
e(list(...)))[-1L]    mirn <- missing(row.names)    mrn <- is.null(row.names)    x <- list(...)    n <- length(x)    if (n < 1L) {        if (!
mrn) {            if (is.object(row.names) || !is.integer(row.names))                 row.names <- as.character(row.names)            if (anyNA
(row.names))                 stop("row names contain missing values")            if (anyDuplicated(row.names))                 stop(gettextf("d
uplicate row.names: %s", paste(unique(row.names[duplicated(row.names)]),                   collapse = ", ")), domain = NA)        }        else
 row.names <- integer()        return(structure(list(), names = character(), row.names = row.names,             class = "data.frame"))    }    
vnames <- names(x)    if (length(vnames) != n)         vnames <- character(n)    no.vn <- !nzchar(vnames)    vlist <- vnames <- as.list(vnames)
    nrows <- ncols <- integer(n)    for (i in seq_len(n)) {        xi <- if (is.character(x[[i]]) || is.list(x[[i]]))             as.data.frame
(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFactors)        else as.data.frame(x[[i]], optional = TRUE)        nrows[i] <- .row_names
_info(xi)        ncols[i] <- length(xi)        namesi <- names(xi)        if (ncols[i] > 1L) {            if (length(namesi) == 0L)            
     namesi <- seq_len(ncols[i])            vnames[[i]] <- if (no.vn[i])                 namesi            else paste(vnames[[i]], namesi, sep 
= ".")        }        else if (length(namesi)) {            vnames[[i]] <- namesi        }        else if (fix.empty.names && no.vn[[i]]) {   
         tmpname <- deparse(object[[i]], nlines = 1L)[1L]            if (startsWith(tmpname, "I(") && endsWith(tmpname,                 ")")) {
                ntmpn <- nchar(tmpname, "c")                tmpname <- substr(tmpname, 3L, ntmpn - 1L)            }            vnames[[i]] <- t
mpname        }        if (mirn && nrows[i] > 0L) {            rowsi <- attr(xi, "row.names")            if (any(nzchar(rowsi)))               
  row.names <- data.row.names(row.names, rowsi,                   i)        }        nrows[i] <- abs(nrows[i])        vlist[[i]] <- xi    }    
nr <- max(nrows)    for (i in seq_len(n)[nrows < nr]) {        xi <- vlist[[i]]        if (nrows[i] > 0L && (nr%%nrows[i] == 0L)) {            
xi <- unclass(xi)            fixed <- TRUE            for (j in seq_along(xi)) {                xi1 <- xi[[j]]                if (is.vector(xi1
) || is.factor(xi1))                   xi[[j]] <- rep(xi1, length.out = nr)                else if (is.character(xi1) && inherits(xi1, "AsIs"))
                   xi[[j]] <- structure(rep(xi1, length.out = nr),                     class = class(xi1))                else if (inherits(xi1
, "Date") || inherits(xi1,                   "POSIXct"))                   xi[[j]] <- rep(xi1, length.out = nr)                else {          
        fixed <- FALSE                  break                }            }            if (fixed) {                vlist[[i]] <- xi            
    next            }        }        stop(gettextf("arguments imply differing number of rows: %s",             paste(unique(nrows), collapse =
 ", ")), domain = NA)    }    value <- unlist(vlist, recursive = FALSE, use.names = FALSE)    vnames <- as.character(unlist(vnames[ncols > 0L])
)    if (fix.empty.names && any(noname <- !nzchar(vnames)))         vnames[noname] <- paste0("Var.", seq_along(vnames))[noname]    if (check.na
mes) {        if (fix.empty.names)             vnames <- make.names(vnames, unique = TRUE)        else {            nz <- nzchar(vnames)       
     vnames[nz] <- make.names(vnames[nz], unique = TRUE)        }    }    names(value) <- vnames    if (!mrn) {        if (length(row.names) ==
 1L && nr != 1L) {            if (is.character(row.names))                 row.names <- match(row.names, vnames, 0L)            if (length(row.
names) != 1L || row.names < 1L ||                 row.names > length(vnames))                 stop("'row.names' should specify one of the varia
bles")            i <- row.names            row.names <- value[[i]]            value <- value[-i]        }        else if (!is.null(row.names) 
&& length(row.names) !=             nr)             stop("row names supplied are of the wrong length")    }    else if (!is.null(row.names) && 
length(row.names) != nr) {        warning("row names were found from a short variable and have been discarded")        row.names <- NULL    }  
  class(value) <- "data.frame"    if (is.null(row.names))         attr(value, "row.names") <- .set_row_names(nr)    else {        if (is.object
(row.names) || !is.integer(row.names))             row.names <- as.character(row.names)        if (anyNA(row.names))             stop("row name
s contain missing values")        if (anyDuplicated(row.names))             stop(gettextf("duplicate row.names: %s", paste(unique(row.names[dup
licated(row.names)]),                 collapse = ", ")), domain = NA)        row.names(value) <- row.names    }    value})(y = c(NA, -1.0417146
4449378, -2.07136423660089, -1.0114740485218, -0.84081468381681, -0.0971227329322377, 0.950550163630083, -0.222293496485566, -1.29786747283316,
 -1.04704167309052, -0.399453066276317, 1.04386570776037, 0.870726774118527, 2.20472706435535, 5.68346660894645, 5.55167552575581, 4.6171145096
694, 3.29823259891842, 1.69965943782442, 0.473995473087085, 0.321478109555683, -0.60582658225137, -1.95228173924119, 0.327027655707095, 1.48782
901843891, 4.16874777724186, 5.1113846553027, 3.87916557888019, 2.56376804160816, 2.27504900639588, 0.682761520272093, 0.594605266553044, -0.74
9452881637354, -0.188139002748451, 0.177948363565268, 0.61124248809906, -0.0289472837212842, 0.821569468589217, -0.314073249845911, -0.22895904
8092999, -1.09349350246074, -0.277956119665636, -1.5873091044285, -1.21474106815546, -2.51187914162691, -3.23793156736206, -4.61516547752734, -
3.53124691751023, -3.66943821525078, -2.69318054991104, -2.37143968693708, -0.6935443246182, 0.149367691593709, 1.22062959264604, -0.1624558336
75592, -0.914639304066951, -0.744273784747386, -0.109833963657019, -1.11323522949695, -0.402663555662565, -0.290496056121615, 1.600680584203, 2
.84845909234101, 3.33766832479556, 2.86079957077869, 4.85993767248109, 2.47113044139191, 2.50097790066372, 1.67930868535907, 1.70895837977236, 
0.368800543588458, -0.992366932948676, -1.97393883481013, -1.67174610955696, -3.54130185553359, -3.85354537115212, -2.68168457226941, -2.044915
56933402, 0.357888577285866, 1.0737044582077, 3.33726446001206, 5.32216030678439, 7.351848869967, 6.48601256502126, 5.68458437406486, 4.2129824
9199096, 2.34685745527529, 1.40895389950328, 1.19487581536617, 0.355340238701186, -0.059840769970001, -0.695425401827246, -1.31177501744237, 0.
276215533906485, 0.758265139016557, -2.27836330571896, -2.35025661777769, -2.61596516056078, -1.34320971106416, -0.123771424251613, -0.44841389
1834067, -0.316196521664855, 1.6619773471351, 4.30871877051479, 5.13090138646199, 3.43258081690189, 1.7861111750715, 3.05098274795683, 2.066733
39543592, 3.55880820581868, 4.53421163825887, 4.6724350134654, 6.01869265982463, 7.35406603782585, 5.94984889780168, 4.84791005880652, 3.053016
86912406, 0.591516791537034, -0.641699549434224, -1.76866606140507, -2.11885453818981, -1.75297528318986, -1.09248827542421, -0.487698854358102
, -0.498076297981664, 0.207093806490269, 0.49763591581473, 0.867352142998151, 0.852259650644061, 1.25993683483682, 1.32617017568567, 1.39208689
112137, 1.22943911141436, 0.371908349374772, 0.467007361890484, 0.0469246534137995, 0.0714451359728047, -0.526405224520475, -0.679908387625354,
 -0.675699288412499, -0.198512190821314, 0.20422735510419, 0.0969157612184976, 0.300313881183637, 1.14528566789652, 2.78783760687165, 3.8645191
9469795, 3.73894517833297, 3.59956473731466, 4.13096444390424, 3.40027731175185, 2.60555938248347, 1.44481259810485, 0.590701808135177, 1.15105
924755714, 1.18618510580281, 1.26626965197165, 0.931277835896577, 0.922256010104286, 0.463947118343414, 0.805937086862015, 0.0842550638192533, 
0.374588309572124, 0.655835647668671, 0.859117719232362, 1.01376341943459, 1.28124032033253, 0.295179092565561, 0.384245218996183, -0.039398585
4367036, -0.0394325228666942, -0.67950623954711, -0.989065642189516, -0.827690699661661, -0.342710947969072, -0.212583284005002, -0.30755884391
8869, -1.00802800140855, -0.565679193580012, -0.166237459021417, -0.508259188621014, -1.11259602412609, -0.448989687419665, -1.10563123571348, 
0.132022085708057, 0.423248637852216, 1.51290040208717, 1.8283551979732, 3.30757157529576, 3.34869785741808, 3.58946477092119, 3.12356699670833
, 3.16748339478779, 3.07349020054808, 3.14958739723347, 2.29518908093874, 1.13278842457346, 0.718373588380327, 0.757266204612639, 0.51540170396
5034, 0.00440880607579464, -0.400451993003333, -0.736628047961467, -0.0109369891096557, 0.100156257444916, 0.0999893595162772, -0.5935312886993
68, -0.178630826351005, 0.368583477344246, 0.239023212360825, 0.324724666283148, 0.255119600617943, 0.0837721208419239, 0.333652521594889, 1.04
33384859427, 0.68421745153494, 1.79649046031326, 4.31106215783922, 5.84346710010553, 6.39158366497052, 6.45897377760604, 5.35999613334769, 5.34
572829047374, 4.25675373044665, 2.51260115765941, 1.548504314464, 1.86047812020706, 1.62870649075811, 2.45678484794173, 1.85838477766539, 1.816
84739795257, 1.98896521919032, 2.35197675510299, 2.34330653385831, 2.1058552137275, 2.17257541559368, 2.15897777822031, 2.16910287057494, 2.940
28259426398, 2.02727360313091, 1.17543787934051, 1.40241306736632, 0.891053633484698, 0.976412486186222, 1.25375077048646, 1.10558534122843, 1.
39935961514811, 1.8763764701094, 1.66168637782664, 1.74285319846925, 1.81101314742128, 1.56934132726459, 1.08754715993704, 0.647171621627253, 0
.350903436096046, 0.0305751877703997, 0.0907944359326139, 0.355630553718157, 0.283416166346792, 0.14220763053947, 0.234907698140712, 0.38717891
2834855), p = c(NA, -0.229192721581241, -0.498685697941301, 0.411873385330541, -0.81104623537584, -1.05641641399829, -0.191639942517047, 1.4208
0574529978, -2.79735992481169, 1.24487483338339, -2.46697649281397, 0.690932960539468, 1.46788002954495, 3.42683036230351, -0.913961294198468, 
2.73836704633274, 0.886821155848605, 2.28118371782283, 2.47638841871468, 2.77807891561483, 1.05024205027456, 1.02926883580716, 0.04072967955493
26, 1.23015389537518, 1.17168470612799, 1.40321241832315, 1.97824927988735, 2.07360379342234, 1.96357277205765, 1.9228765283446, 0.672060775642
297, 1.89558789208181, 1.16495902302578, 0.976770256366538, 0.113885429909354, 1.33305708341778, 1.87545053256488, -0.499748748594618, 1.160477
28368333, 1.63358349516457, 0.867232525019407, 0.851727777882802, 0.445737640170609, 0.847634686604919, 1.69849330694611, 0.241167091027053, 0.
320573461809134, -0.126251465134965, -0.784396517778736, 0.0848552723094542, 1.79348911406545, 1.53993508182564, 0.250367030462005, -0.08381885
75529264, 0.042120112303822, 0.441664550775843, 0.621060271159322, -1.70260046321357, -0.468027403765151, -1.07849417361287, -1.45754852997501,
 -0.699563109077635, -0.839215964765695, -0.937745766332612, 1.62432761271896, -0.503324281008162, -0.767731761048568, 0.255239650696366, 1.078
02327120299, 1.66661671085475, -1.36031923933474, 1.45290782138033, 0.00102038886853206, -1.15705770660998, -0.738003396821987, -2.328493347857
29, -4.40727498705439, -4.05484932794871, -4.03448952743936, -5.5066642256898, -7.25032193783352, -6.80024615968028, -3.44677733353779, 0.46175
876119576, -0.734676367150391, -0.908468338386364, 2.32622646804455, 2.93348633929643, 0.970177011509003, -2.67827211968575, -2.87316987746046,
 -1.49865323467884, -0.88446985752654, -5.1201824209211, -2.26593951723951, -3.85095890744287, -2.63264369774804, -4.19589587417085, -3.1757074
3422576, -5.55660952682825, -3.60866100029432, -2.97594615563998, -2.91963627237032, -4.0206363850766, -2.70589930182411, -4.40625579405671, -4
.04776931774467, -1.52584669159069, -0.897953763739444, 0.20866504200572, 0.874814971483062, 0.28568028592198, 1.74291665144207, 3.685243876200
94, 4.25875427369102, 4.23822958416318, 1.6093951078365, 2.27797516718725, 1.20988832637381, 0.958910455113831, -0.0410244528230521, 0.20666357
7241013, -0.502071277302263, 1.50476450626313, 1.58399948518289, 2.22594147422146, 2.66499424492109, 3.37928637731185, 2.6162007793011, 2.13338
690616327, 1.32208844756338, 1.15153150059254, 0.887520229036095, 0.613365809329919, 0.281908890829551, -0.593906571212425, -1.39038187879942, 
-0.00694574216804877, -0.528642844069136, -0.497872901638216, 1.04339410505066, 1.00338400915674, -0.0819070597967064, 0.116249713923546, 1.069
57380820925, 1.95761770232646, 1.10597938222946, 1.63484210348029, 1.23573965493385, 2.30052013023177, 3.16712835350098, 1.88905564399458, 1.87
789959287565, 0.809275120423405, 0.988826586828388, 0.82799525182804, 0.425283923176786, 0.327884214773681, 0.824725053913592, 0.64234089894513
8, 0.478060186138877, 0.405126517085858, 0.414470903145733, 0.65042412981745, 0.651031511624099, 0.73309446767384, 1.02148914755752, 1.48194991
96534, 2.03440895989831, 1.30183336672092, 0.978519534523246, 2.54085364635615, 1.58453720733504, 1.92926918995854, 2.71987881367135, 2.3213234
4265552, 1.75618902582836, 2.39646467278091, 2.0377542486901, 2.06877707205947, 2.03751408344762, 1.09052466046521, 0.705071495943026, 1.091520
7192313, 1.04218496740325, 1.20963383971664, 0.779303458286176, 1.08845150134696, 2.26347030513217, 2.65827516629047, 2.84738475896886, 2.62492
362935517, 1.9791618464121, 1.30679045959372, 1.23772595865072, 1.27277207650609, -0.0829108572735655, -0.330550756718076, -0.675500485842323, 
-0.978061566971437, -0.397281880830827, -1.05064653510856, -1.23908018084464, -0.64136325437257, -1.24226193018939, -0.765960010500577, -0.2348
74114395304, -0.965410575407219, 0.089295779792494, 1.60346562249609, -0.710940092169914, 0.763892677254593, 1.38599893860903, 1.91229350481615
, 2.41982492470841, 1.63948193472965, 0.414297236655637, 2.9835966474907, 3.88931103998974, 4.23221781191898, 2.90458493099201, 1.4959461305998
4, 1.63656640693562, 0.802045391882169, 0.311620513399744, -1.40908786675917, -1.32894019261678, -1.64874395489265, -1.1670862166383, 0.8031481
33177062, -0.828231939581594, -0.113653594215118, -0.291832879373913, -0.415145398340747, 0.176275730085455, 0.530002144148253, -0.560555373802
229, -0.550482256861319, 0.00452134468348575, -0.533540328156636, -0.0747166486250512, 0.974134515162385, 1.61951996252229, -0.470499700477107,
 0.662183822380382, 1.59273265152289, 2.14943042571656, -1.00079235772809, 0.46879252566246, -0.653088129089936, -0.0182743049140845, 0.4762066
84025414, -0.551735811523343, -1.39871131919443, -0.0319846502761951, -1.77455453418085, 0.723468884235984, -0.00253107124369523, 0.78273723725
4006, -0.0301395489795793, 1.24672135398587, 0.866289936320114), ff = c(NA, -0.063326412043503, -0.327254384894812, 0.0630931811916375, -0.2079
63672681309, -0.0132115175762433, 0.418573998056765, 0.289154478393644, -0.986285400744099, 0.249808373119544, 0.600392428709123, 1.67259872328
238, 2.33085183276967, 2.11535733988075, 3.01965638726982, 5.00118457322625, 3.47680940225078, 4.34982474367077, 2.47794340190924, 2.0310044461
8739, 0.0192994727968157, -0.893240380915633, -3.17777877575101, -1.60891236504203, 0.0947521606796244, 0.963598699923005, 1.97241154043038, 2.
82466505731791, 3.05307445361194, 2.66042278262455, 1.65059372226445, 0.810878941246378, -0.782842428548953, -1.36222967130566, -1.405523629905
54, -1.13257387441334, -0.447157464852298, 0.0748035994064509, -0.466339782341318, -0.142274036256453, -0.256130892549347, 0.0977563834294668, 
-0.76513815357496, -0.26909581851517, 0.935666401635122, 0.280470182972412, -0.245316544743118, -0.184939618355814, -0.696634173151836, -0.0040
9429599125666, 0.813594313230532, 1.86342822885099, 2.95084083624916, 3.3801405763815, 3.14385059355091, 2.5960001649615, 2.45150869609362, 0.9
69854891094057, -0.600891268985021, -1.69107560349037, -1.92239888707922, -1.03934152209134, 0.511969827797069, 0.916945426236975, 2.6207740938
303, 3.82223336583999, 7.35861913397419, 7.39144623943109, 5.79602882795633, 6.08377254979566, 6.42952536877234, 3.59212786400513, 2.4557233992
8662, 1.40391740896429, 0.230736911716065, -0.734312925547564, -4.64459233569219, -3.63684227050659, -3.44799602431798, -4.32153583109362, -3.9
6098452484096, 0.35136716002738, 5.33455067996009, 9.04249467018953, 7.88449001157326, 7.28388970592313, 10.3015994398349, 11.1784861875327, 8.
22812947409235, 4.04491301956841, 2.00983818144176, 2.96761245671401, 1.61860655269184, -0.288845928635615, -0.292539442983523, -0.296014763088
064, -0.602211613825021, -2.50328990050961, -2.56508956164109, -2.12101851532808, -0.802230772964393, -4.64327144644253, -3.91039392500735, -1.
15460071160882, 3.83049375412845, -2.37030289473757, -2.08821408533533, -3.10052465762332, -1.23095997340142, 4.43211364529962, 1.3149745949149
6, -2.04402201241484, 8.02977638719636, 10.8505829036364, 10.995694791389, 10.6211926733194, 5.4848879911481, 4.79306180165145, 4.5712982421827
3, 0.367553786443436, -2.94622725160109, -1.76009562233923, -0.433487058956224, 1.63454597560027, 1.44284049465666, 2.25163193432175, 3.2904864
1827065, 5.04368859939246, 3.52794597188236, 3.19794056300817, 2.10926041266811, 1.77276333481953, 1.64668772187148, 1.22975776237421, 0.314655
201488942, -0.739970400331704, -1.35982623061866, -1.74609747598452, -2.13902825070657, -2.11094428963589, -1.04820600952053, -0.91191496810680
3, 0.410786350000119, 1.52208191991891, 1.62982846522956, 3.34656927408237, 4.96864655657976, 4.34420361328081, 3.94047934398697, 5.20983224401
609, 5.96963167848529, 5.48933005458204, 4.94286585986004, 4.04891999254193, 3.13130070325309, 3.01967278137342, 1.78333398307005, 0.8949231197
68645, 0.988899033533573, -0.307086414097035, -0.576311952971396, -1.6248666592958, -2.26693568313219, -2.47771197404217, -2.20141541535038, -1
.95273473771213, -0.716230344464838, 0.0402389430615031, 0.685334920061126, 1.20338633171545, 1.16853056390743, 0.788988442622664, 0.6830796687
95772, 0.393356175737644, 0.425439733348541, 0.378859067635277, 0.755039644663279, 1.46791062903829, 1.33751215224214, 1.84328741115418, 1.2479
2077765006, 0.721037770829102, 0.464427383750023, 0.32022361280417, -0.647150917173654, -0.665273657481282, 0.267632676547496, 1.89481430005507
, 3.45410370306301, 5.14444941328464, 6.26235354370972, 6.13339525921228, 5.92180270793412, 5.24851557953395, 4.12756565127089, 2.6339444112753
9, 1.33307858050258, 1.05023341496437, 1.09052481317623, 1.24975625439351, 0.575623851749329, -0.283558088749579, -1.00204400907347, -0.9721558
17289451, -1.2621131493284, -1.62927227652552, -1.88452074333761, -2.15011870309464, -1.66978286911072, -1.00893452929436, -0.749504096647169, 
0.113713745230616, 0.579832217527144, 1.64204939253438, 3.60940917500705, 4.55562897550674, 4.22349571911989, 6.65945300623272, 6.4982943993485
3, 6.10374041278938, 5.46385307322339, 3.88668606999765, 3.18774096731282, 3.14581259178947, 0.122903999899204, -1.14374584039001, -1.492756639
04242, -0.931937965275412, -0.339072313025664, -0.368897600944827, 0.231043881089862, -0.0349786631684591, 0.534197407119342, 0.184331002239386
, 0.488862219993326, 0.302451614733994, -0.362778995702077, 0.656972505606692, 0.357267204930341, 0.460991553675116, 0.362184859308279, 0.26918
6053702313, -0.0657620155263319, 0.329458067627566, 0.623345800633755, 0.0228906692237999, 0.353157416298056, 0.309802870117217, -0.19673283666
4469, -0.501336276844305, 0.337694543146422, -0.379044758987052, -1.20505884935986, -1.15330437985234, -0.0033467144413335, -0.992192438771648,
 -0.655441985702172, -0.74466420364392, -0.986019771107245, -0.387124137537353, 0.402692671075361, 0.966820123019883), check.names = FALSE, fix
names = TRUE,     stringsAsFactors = FALSE)
 3: do.call(data.frame, c(x, alis))                                                                                                                                                                                                                                                                                                                                    [2179/28683]
 4: as.data.frame.list(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFactors)
 5: as.data.frame(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFactors)
 6: data.frame(value, row.names = rn, check.names = FALSE)
 7: Ops.data.frame(forecast[, c(regressors)], data.frame(data)[,     c(regressors)])
 8: .f(.x[[i]], ...)
 9: purrr::map(., .f = function(forecast) {    error = data.frame(forecast)    error[, c(regressors)] = forecast[, c(regressors)] - data.frame(
data)[,         c(regressors)]    return(error)})
10: forecasts %>% purrr::map(.f = function(forecast) {    error = data.frame(forecast)    error[, c(regressors)] = forecast[, c(regressors)] - 
data.frame(data)[,         c(regressors)]    return(error)})
11: .f(.x[[i]], ...)
12: purrr::map(., .f = function(regime.val) {    coef = models[[paste0("regime_", regime.val)]]$coef    forecasts = list()    for (i in 1:horiz
on) {        if (i == 1) {            X = Y %>% dplyr::select(dplyr::contains(".l"), dplyr::contains("const"),                 dplyr::contains(
"trend"))            X.date = data$date        }        else {            X = dplyr::bind_rows(dplyr::select(data[1:i, ], date,                
 regressors), dplyr::select(forecast_prev[i +                 1:nrow(forecast_prev), ], date = forecast.date,                 regressors)) %>% 
n.lag(lags = p)            X.date = X$date            X = X %>% dplyr::filter(!is.na(date)) %>% dplyr::select(dplyr::contains(".l"))           
 if ("const" %in% type | "both" %in% type) {                X$const = 1            }            if ("trend" %in% type | "both" %in% type) {    
            X$trend = c(1:nrow(X)) + (i - 1)            }        }        forecast = as.matrix(X) %*% as.matrix(t(coef[, -1]))        colnames(
forecast) = regressors        if (i == 1) {            forecast.date = stats::na.omit(X.date)        }        else {            forecast.date =
 forecast_date(forecast.date = stats::na.omit(X.date),                 horizon = i - 1, freq = freq)        }        forecast = data.frame(date
 = data$date, forecast.date = forecast.date,             forecast) %>% dplyr::left_join(dplyr::select(Y, date,             model.regime = regim
e), by = "date")        forecasts[[paste0("H_", i)]] = forecast        forecast_prev = forecast    }    residuals = forecasts %>% purrr::map(.f
 = function(forecast) {        error = data.frame(forecast)        error[, c(regressors)] = forecast[, c(regressors)] -             data.frame(
data)[, c(regressors)]        return(error)    })    residuals = residuals %>% purrr::map(.f = function(r) {        return(dplyr::filter(r, reg
ime.val == model.regime))    })    forecasts = forecasts %>% purrr::map(.f = function(f) {        return(dplyr::filter(f, regime.val == model.r
egime))    })    return(list(forecasts = forecasts, residuals = residuals))})
13: as.list(regimes) %>% purrr::map(.f = function(regime.val) {    coef = models[[paste0("regime_", regime.val)]]$coef    forecasts = list()   
 for (i in 1:horizon) {        if (i == 1) {            X = Y %>% dplyr::select(dplyr::contains(".l"), dplyr::contains("const"),               
  dplyr::contains("trend"))            X.date = data$date        }        else {            X = dplyr::bind_rows(dplyr::select(data[1:i, ], dat
e,                 regressors), dplyr::select(forecast_prev[i +                 1:nrow(forecast_prev), ], date = forecast.date,                
 regressors)) %>% n.lag(lags = p)            X.date = X$date            X = X %>% dplyr::filter(!is.na(date)) %>% dplyr::select(dplyr::contains
(".l"))            if ("const" %in% type | "both" %in% type) {                X$const = 1            }            if ("trend" %in% type | "both
" %in% type) {                X$trend = c(1:nrow(X)) + (i - 1)            }        }        forecast = as.matrix(X) %*% as.matrix(t(coef[, -1])
)        colnames(forecast) = regressors        if (i == 1) {            forecast.date = stats::na.omit(X.date)        }        else {         
   forecast.date = forecast_date(forecast.date = stats::na.omit(X.date),                 horizon = i - 1, freq = freq)        }        forecast
 = data.frame(date = data$date, forecast.date = forecast.date,             forecast) %>% dplyr::left_join(dplyr::select(Y, date,             mo
del.regime = regime), by = "date")        forecasts[[paste0("H_", i)]] = forecast        forecast_prev = forecast    }    residuals = forecasts
 %>% purrr::map(.f = function(forecast) {        error = data.frame(forecast)        error[, c(regressors)] = forecast[, c(regressors)] -      
       data.frame(data)[, c(regressors)]        return(error)    })    residuals = residuals %>% purrr::map(.f = function(r) {        return(dp
lyr::filter(r, regime.val == model.regime))    })    forecasts = forecasts %>% purrr::map(.f = function(f) {        return(dplyr::filter(f, reg
ime.val == model.regime))    })    return(list(forecasts = forecasts, residuals = residuals))})
14: RVAR_estimate(data = data, p = p, regime = regime, horizon = horizon,     freq = freq, type = type)
15: sovereign::RVAR(data = Data.rec, regime = "cycle_position", p = 1,     horizon = 10, freq = "quarter")
16: eval(expr, envir, enclos)
17: eval(expr, envir, enclos)
18: eval_with_user_handlers(expr, envir, enclos, user_handlers)
19: withVisible(eval_with_user_handlers(expr, envir, enclos, user_handlers))
20: withCallingHandlers(withVisible(eval_with_user_handlers(expr,     envir, enclos, user_handlers)), warning = wHandler, error = eHandler,    
 message = mHandler)
21: handle(ev <- withCallingHandlers(withVisible(eval_with_user_handlers(expr,     envir, enclos, user_handlers)), warning = wHandler, error = 
eHandler,     message = mHandler))
22: timing_fn(handle(ev <- withCallingHandlers(withVisible(eval_with_user_handlers(expr,     envir, enclos, user_handlers)), warning = wHandler
, error = eHandler,     message = mHandler)))
23: evaluate_call(expr, parsed$src[[i]], envir = envir, enclos = enclos,     debug = debug, last = i == length(out), use_try = stop_on_error !=
         2L, keep_warning = keep_warning, keep_message = keep_message,     output_handler = output_handler, include_timing = include_timing)
24: evaluate::evaluate(...)
25: evaluate(code, envir = env, new_device = FALSE, keep_warning = !isFALSE(options$warning),     keep_message = !isFALSE(options$message), sto
p_on_error = if (is.numeric(options$error)) options$error else {        if (options$error && options$include)             0L        else 2L    
}, output_handler = knit_handlers(options$render, options))
26: in_dir(input_dir(), expr)
27: in_input_dir(evaluate(code, envir = env, new_device = FALSE,     keep_warning = !isFALSE(options$warning), keep_message = !isFALSE(options$
message),     stop_on_error = if (is.numeric(options$error)) options$error else {        if (options$error && options$include)             0L  
      else 2L    }, output_handler = knit_handlers(options$render, options)))
28: eng_r(options)
29: block_exec(params)
30: call_block(x)
31: process_group.block(group)
32: process_group(group)
33: withCallingHandlers(if (tangle) process_tangle(group) else process_group(group),     error = function(e) {        setwd(wd)        cat(res,
 sep = "\n", file = output %n% "")        message("Quitting from lines ", paste(current_lines(i),             collapse = "-"), " (", knit_conco
rd$get("infile"),             ") ")    })
34: process_file(text, output)
35: knitr::knit(knit_input, knit_output, envir = envir, quiet = quiet)
36: rmarkdown::render(file, encoding = encoding, quiet = quiet, envir = globalenv(),     output_dir = getwd(), ...)
37: vweave_rmarkdown(...)
38: engine$weave(file, quiet = quiet, encoding = enc)
39: doTryCatch(return(expr), name, parentenv, handler)
40: tryCatchOne(expr, names, parentenv, handlers[[1L]])
41: tryCatchList(expr, classes, parentenv, handlers)
42: tryCatch({    engine$weave(file, quiet = quiet, encoding = enc)    setwd(startdir)    output <- find_vignette_product(name, by = "weave", e
ngine = engine)    if (!have.makefile && vignette_is_tex(output)) {        texi2pdf(file = output, clean = FALSE, quiet = quiet)        output 
<- find_vignette_product(name, by = "texi2pdf",             engine = engine)    }    outputs <- c(outputs, output)}, error = function(e) {    t
hisOK <<- FALSE    fails <<- c(fails, file)    message(gettextf("Error: processing vignette '%s' failed with diagnostics:\n%s",         file, c
onditionMessage(e)))})
43: tools:::buildVignettes(dir = "/c4/home/henrik/repositories/future/revdep/checks/sovereign/new/sovereign.Rcheck/vign_test/sovereign",     se
r_elibs = "/scratch/henrik/493473/Rtmplr8xJT/file1a2a916199ca4.rds")
An irrecoverable exception occurred. R is aborting now ...

* DONE
Status: 1 WARNING

standard errors bootstrap with RVAR

Hi,
I am writing to ask you about the package you developed on R (sovereign).
Specifically, I wanted to ask about the differences between your package and tsDyn, with which it is possible to estimate TVAR with an external threshold.

The TVAR command with an external threshold does not allow standard errors to be calculated with bootstrap, whereas the RVAR package does.
Furthermore, in the TVAR package, it is possible to calculate GIRFs, as Koop et al. (1996) proposed.
What is the difference between GIRFs and IRFs estimated with RVAR?

Thank you in advance for your help

ERROR: the condition has length > 1 (_R_CHECK_LENGTH_1_CONDITION_ bug)

FYI, when submitting an updated version of the future package, CRAN reported that it broke sovereign (see below). Now, I've checked and tested this and it looks like future is not to blame. Instead, I think it's a bug in sovereign that kicks in sporadically, probably due to randomness.

The culprit is in the line:

if (is.na(breakpoints$breakpoints)) {

Depending on length(breakpoints$breakpoints), you'll end up a logical vector of length zero, one, or more. An if-statment requires a single logical value. So, this is a bug. To make it robust, it should be something like:

if (anyNA(breakpoints$breakpoints)) {

or whatever the logical should be. You can test this yourself by setting environment variable _R_CHECK_LENGTH_1_CONDITION_=true and running the above tests until length(breakpoints$breakpoints) != 1. Conceptually,

Sys.setenv("_R_CHECK_LENGTH_1_CONDITION_"="true")
breakpoints <- list(breakpoints = c(TRUE, FALSE))
if (is.na(breakpoints$breakpoints)) print(42)
## Error in if (is.na(breakpoints$breakpoints)) print(42) : 
##  the condition has length > 1

FYI, running with R CMD check --as-cran will effectively set _R_CHECK_LENGTH_1_CONDITION_=true for you package code.

The randomness appear to come from:

  # simple time series
  AA = c(1:100) + rnorm(100)
  BB = c(1:100) + rnorm(100)
  CC = AA + BB + rnorm(100)

Detailed error log:

Package: sovereign
...
Check: tests
New result: ERROR
    Runningtestthat.R’ [83s/83s]
  Running the tests intests/testthat.Rfailed.
  Complete output:
    > library(testthat)
    > library(sovereign)
    >
    > test_check("sovereign")
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
    :
     --- package (from environment) ---
    sovereign
     --- call from context ---
    regimes(data = Data[, c(1, 2)], method = "BP")
     --- call from argument ---
    if (is.na(breakpoints$breakpoints)) {
        regimes = data.frame(date = X.date, X, regime = 0)
    } else {
        regimes.val = c(0:length(breakpoints$breakpoints))
        regimes.dates = data$date[c(1, breakpoints$breakpoints)]
        regimes = dplyr::full_join(dplyr::select(data, date), data.frame(date = regimes.dates,
            regime = regimes.val), by = "date")
        regimes = tidyr::fill(regimes, regime)
    }
     --- R stacktrace ---
    where 1 at test-regimes.R#30: regimes(data = Data[, c(1, 2)], method = "BP")
    where 2: eval(code, test_env)
    where 3: eval(code, test_env)
    where 4: withCallingHandlers({
        eval(code, test_env)
        if (!handled && !is.null(test)) {
            skip_empty()
        }
    }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
        message = handle_message, error = handle_error)
    where 5: doTryCatch(return(expr), name, parentenv, handler)
    where 6: tryCatchOne(expr, names, parentenv, handlers[[1L]])
    where 7: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
    where 8: doTryCatch(return(expr), name, parentenv, handler)
    where 9: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
        names[nh], parentenv, handlers[[nh]])
    where 10: tryCatchList(expr, classes, parentenv, handlers)
    where 11: tryCatch(withCallingHandlers({
        eval(code, test_env)
        if (!handled && !is.null(test)) {
            skip_empty()
        }
    }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
        message = handle_message, error = handle_error), error = handle_fatal,
        skip = function(e) {
        })
    where 12: test_code(desc, code, env = parent.frame(), reporter = reporter)
    where 13 at test-regimes.R#1: test_that("Regime learning functions", {
        AA = c(1:100) + rnorm(100)
        BB = c(1:100) + rnorm(100)
        CC = AA + BB + rnorm(100)
        date = seq.Date(from = as.Date("2000-01-01"), by = "month",
            length.out = 100)
        Data = data.frame(date = date, AA, BB, CC)
        Data = dplyr::mutate(Data, reg = dplyr::if_else(AA > median(AA),
            1, 0))
        regimes.rf = regimes(data = Data, method = "rf")
        regime.kmeans = regimes(data = Data, method = "kmeans")
        regime.em = regimes(data = Data, method = "EM")
        regime.bp = regimes(data = Data[, c(1, 2)], method = "BP")
        expect_true(is.data.frame(regimes.rf))
        expect_true(is.data.frame(regime.kmeans))
        expect_true(is.data.frame(regime.em))
        expect_true(is.data.frame(regime.bp))
    })
    where 14: eval(code, test_env)
    where 15: eval(code, test_env)
    where 16: withCallingHandlers({
        eval(code, test_env)
        if (!handled && !is.null(test)) {
            skip_empty()
        }
    }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
        message = handle_message, error = handle_error)
    where 17: doTryCatch(return(expr), name, parentenv, handler)
    where 18: tryCatchOne(expr, names, parentenv, handlers[[1L]])
    where 19: tryCatchList(expr, names[-nh], parentenv, handlers[-nh])
    where 20: doTryCatch(return(expr), name, parentenv, handler)
    where 21: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]),
        names[nh], parentenv, handlers[[nh]])
    where 22: tryCatchList(expr, classes, parentenv, handlers)
    where 23: tryCatch(withCallingHandlers({
        eval(code, test_env)
        if (!handled && !is.null(test)) {
            skip_empty()
        }
    }, expectation = handle_expectation, skip = handle_skip, warning = handle_warning,
        message = handle_message, error = handle_error), error = handle_fatal,
        skip = function(e) {
        })
    where 24: test_code(NULL, exprs, env)
    where 25: source_file(path, child_env(env), wrap = wrap)
    where 26: FUN(X[[i]], ...)
    where 27: lapply(test_paths, test_one_file, env = env, wrap = wrap)
    where 28: force(code)
    where 29: doWithOneRestart(return(expr), restart)
    where 30: withOneRestart(expr, restarts[[1L]])
    where 31: withRestarts(testthat_abort_reporter = function() NULL, force(code))
    where 32: with_reporter(reporters$multi, lapply(test_paths, test_one_file,
        env = env, wrap = wrap))
    where 33: test_files(test_dir = test_dir, test_package = test_package,
        test_paths = test_paths, load_helpers = load_helpers, reporter = reporter,
        env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
        wrap = wrap, load_package = load_package)
    where 34: test_files(test_dir = path, test_paths = test_paths, test_package = package,
        reporter = reporter, load_helpers = load_helpers, env = env,
        stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning,
        wrap = wrap, load_package = load_package, parallel = parallel)
    where 35: test_dir("testthat", package = package, reporter = reporter,
        ..., load_package = "installed")
    where 36: test_check("sovereign")

     --- value of length: 2 type: logical ---
    [1] FALSE FALSE
     --- function from context ---
    function (data, method = "rf", regime.n = NULL)
    {
        if (!is.matrix(data) & !is.data.frame(data)) {
            stop("data must be a matrix or data.frame")
        }
        if (!is.null(regime.n) & !is.numeric(regime.n)) {
            stop("regime.n must be a positive integer or NULL")
        }
        if (stats::is.ts(data) | xts::is.xts(data) | zoo::is.zoo(data)) {
            data = data.frame(date = zoo::index(date), data)
        }
        if (method == "bp" & ncol(dplyr::select(data, -date)) > 1) {
            stop("The 'BP' method can only use univariate time series to determine regimes.")
        }
        X = dplyr::select(data, -date)
        X.date = data$date
        if (method == "rf") {
            model = randomForest::randomForest(X)
            regime = data.frame(model$votes)
            colnames(regime) = paste0("Prob_regime_", c(1:ncol(regime)))
            regime = apply(X = regime, MARGIN = 1, which.max)
            regime = data.frame(date = X.date, X, regime)
        }
        else if (method == "kmeans") {
            if (is.null(regime.n)) {
                regime.n = 2
            }
            model = stats::kmeans(X, centers = regime.n)
            regime = data.frame(date = X.date, X, regime = model$cluster)
        }
        else if (method == "EM") {
            mclustBIC = mclust::mclustBIC
            model = mclust::Mclust(X, G = regime.n)
            regime = data.frame(date = X.date, X, regime = model$classification)
        }
        else if (method == "BP") {
            colnames(X) = "x"
            breakpoints = strucchange::breakpoints(x ~ lag(x), data = X)
            breakpoints$breakpoints
            if (is.na(breakpoints$breakpoints)) {
                regimes = data.frame(date = X.date, X, regime = 0)
            }
            else {
                regimes.val = c(0:length(breakpoints$breakpoints))
                regimes.dates = data$date[c(1, breakpoints$breakpoints)]
                regimes = dplyr::full_join(dplyr::select(data, date),
                    data.frame(date = regimes.dates, regime = regimes.val),
                    by = "date")
                regimes = tidyr::fill(regimes, regime)
            }
            regime = data.frame(date = X.date, X, regime = regimes$regime)
        }
        return(regime)
    }
    <bytecode: 0x56301c14e7d0>
    <environment: namespace:sovereign>
     --- function search by body ---
    Function regimes in namespace sovereign has this body.
     ----------- END OF FAILURE REPORT --------------

    Call:
    stats::lm(formula = col_to_instrument ~ ., data = data %>% dplyr::select(col_to_instrument = dplyr::all_of(col_to_instrument),
        dplyr::all_of(instrument)) %>% stats::na.omit())

    Residuals:
         Min       1Q   Median       3Q      Max
    -2.38454 -0.60240  0.02653  0.61219  2.11227

    Coefficients:
                 Estimate Std. Error t value Pr(>|t|)
    (Intercept) -0.001357   0.106144  -0.013    0.990
    inst         0.004291   0.188723   0.023    0.982

    Residual standard error: 0.8688 on 96 degrees of freedom
    Multiple R-squared:  5.386e-06,     Adjusted R-squared:  -0.01041
    F-statistic: 0.000517 on 1 and 96 DF,  p-value: 0.9819


    Call:
    stats::lm(formula = col_to_instrument ~ ., data = data %>% dplyr::select(col_to_instrument = dplyr::all_of(col_to_instrument),
        dplyr::all_of(instrument)) %>% stats::na.omit())

    Residuals:
        Min      1Q  Median      3Q     Max
    -2.3010 -0.6245  0.0758  0.6357  1.5826

    Coefficients:
                Estimate Std. Error t value Pr(>|t|)
    (Intercept) -0.04178    0.15758  -0.265    0.792
    inst         0.11798    0.26480   0.446    0.658

    Residual standard error: 0.8774 on 46 degrees of freedom
    Multiple R-squared:  0.004297,      Adjusted R-squared:  -0.01735
    F-statistic: 0.1985 on 1 and 46 DF,  p-value: 0.658


    Call:
    stats::lm(formula = col_to_instrument ~ ., data = data %>% dplyr::select(col_to_instrument = dplyr::all_of(col_to_instrument),
        dplyr::all_of(instrument)) %>% stats::na.omit())

    Residuals:
         Min       1Q   Median       3Q      Max
    -1.57728 -0.65985 -0.05007  0.70768  1.78503

    Coefficients:
                Estimate Std. Error t value Pr(>|t|)
    (Intercept) -0.02637    0.13495  -0.195    0.846
    inst         0.09417    0.25504   0.369    0.714

    Residual standard error: 0.8097 on 48 degrees of freedom
    Multiple R-squared:  0.002832,      Adjusted R-squared:  -0.01794
    F-statistic: 0.1363 on 1 and 48 DF,  p-value: 0.7136

    ══ Failed tests ════════════════════════════════════════════════════════════════
    ── Error (test-regimes.R:30:2): Regime learning functions ──────────────────────
    Error: the condition has length > 1
    Backtrace:1. └─sovereign::regimes(data = Data[, c(1, 2)], method = "BP") test-regimes.R:30:1

    [ FAIL 1 | WARN 30 | SKIP 0 | PASS 97 ]
    Error: Test failures
    Execution halted

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.