Skip to content

Commit

Permalink
when interopolations fail use PBA root estimate
Browse files Browse the repository at this point in the history
  • Loading branch information
philchalmers committed Feb 7, 2025
1 parent aee4512 commit f337444
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion R/PBA.R
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,11 @@ PBA <- function(f.root, interval, ..., p = .6,
fx <- exp(fx) / sum(exp(fx)) # normalize final result
medhistory <- medhistory[1L:(iter-1L)]
# BI <- belief_interval(x, fx, CI=CI)
root <- if(!interpolate) medhistory[length(medhistory)] else glmpred0[1L]
root <- if(!interpolate || is.na(glmpred0[1]))
medhistory[length(medhistory)] else glmpred0[1L]
if(interpolate && is.na(glmpred0[1]))
warning('Interpolation model failed; root value set to last PBA root estimate',
call.=FALSE)
ret <- list(iter=iter, root=root, terminated_early=converged, integer=integer,
e.froot=e.froot, x=x, fx=fx, medhistory=medhistory,
time=as.numeric(proc.time()[3L]-start_time),
Expand Down

0 comments on commit f337444

Please sign in to comment.