Skip to content

Commit

Permalink
add track_progress argument to loo_residuals
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Thorson committed Sep 17, 2024
1 parent cb1d37f commit a102b15
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
5 changes: 5 additions & 0 deletions R/utility.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#' @param what whether to return quantile residuals, or samples from the leave-one-out predictive
#' distribution of data, or a table of leave-one-out predictions and standard errors for the
#' latent state
#' @param track_progress whether to track runtimes on terminal
#' @param ... Not used
#'
#' @details
Expand All @@ -31,6 +32,7 @@ loo_residuals <-
function( object,
nsim = 100,
what = c("quantiles","samples","loo"),
track_progress = TRUE,
... ){

# Extract and make object
Expand All @@ -44,6 +46,9 @@ function( object,

# Loop through observations
for(r in 1:nrow(df) ){
if( (r %% floor(nrow(df)/10))==1 ){
if(isTRUE(track_progress)) message("Running leave-one-out fit ",r," of ",nrow(df)," at ",Sys.time())
}
ts_r = tsdata
ts_r[match(df[r,1],time(tsdata)),match(df[r,2],colnames(tsdata))] = NA

Expand Down
10 changes: 9 additions & 1 deletion man/loo_residuals.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a102b15

Please sign in to comment.