Skip to content

Commit f337444

Browse files
committed
when interopolations fail use PBA root estimate
1 parent aee4512 commit f337444

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

R/PBA.R

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,11 @@ PBA <- function(f.root, interval, ..., p = .6,
346346
fx <- exp(fx) / sum(exp(fx)) # normalize final result
347347
medhistory <- medhistory[1L:(iter-1L)]
348348
# BI <- belief_interval(x, fx, CI=CI)
349-
root <- if(!interpolate) medhistory[length(medhistory)] else glmpred0[1L]
349+
root <- if(!interpolate || is.na(glmpred0[1]))
350+
medhistory[length(medhistory)] else glmpred0[1L]
351+
if(interpolate && is.na(glmpred0[1]))
352+
warning('Interpolation model failed; root value set to last PBA root estimate',
353+
call.=FALSE)
350354
ret <- list(iter=iter, root=root, terminated_early=converged, integer=integer,
351355
e.froot=e.froot, x=x, fx=fx, medhistory=medhistory,
352356
time=as.numeric(proc.time()[3L]-start_time),

0 commit comments

Comments
 (0)