Seeing the following issue when running posterior_survfit with newdataLong and newdataEvent:
Error in optim(inits, optim_fn, object = object, data = dat_i, pars = pars_means, : │ newtimes[newtimes < 0] <- 0.0 # use baseline where lagged t is before baseline
initial value in 'vmmin' is not finite
Description:
This error appears to only occur when running posterior_survfit on newdata, when either ll_event or ll_b evaluate to NaN or -Inf.
I have observed this error in two scenarios, which I will attempt to describe here.
In one case, I noticed that on line 568 of log_lik.R, within ll_jm function code, the value ll_b was Inf.
This section reads as follows:
ll_b <- mvtnorm::dmvnorm(b, mean = mu, sigma = Sigma, log = TRUE) ## <- line 568
I have not yet been able to reproduce this scenario with a public dataset.
In a separate example, reproduced below, ll_event evaluated to NaN when qtimes was a vector of 0s. This appears to happen when using a weibull basehaz to estimate posterior survival probabilities where the last given biomarker time is at time 0, since this is used as a last evaluation time for each id. (see "reproducible steps" below for the logic behind this assertion).
Within the call to ll_event, the introduction of NaN values occurs on the following line:
This yields the following (which may depend on the sample of ids given; here it was observed with id == 18 of pbcSurv):
Error in optim(inits, optim_fn, object = object, data = dat_i, pars = pars_means, : │ newtimes[newtimes < 0] <- 0.0 # use baseline where lagged t is before baseline
initial value in 'vmmin' is not finite
Summary:
Seeing the following issue when running posterior_survfit with
newdataLong
andnewdataEvent
:Description:
This error appears to only occur when running posterior_survfit on newdata, when either ll_event or ll_b evaluate to
NaN
or-Inf
.I have observed this error in two scenarios, which I will attempt to describe here.
In one case, I noticed that on line 568 of log_lik.R, within
ll_jm
function code, the valuell_b
was Inf.This section reads as follows:
I have not yet been able to reproduce this scenario with a public dataset.
In a separate example, reproduced below,
ll_event
evaluated toNaN
whenqtimes
was a vector of 0s. This appears to happen when using a weibull basehaz to estimate posterior survival probabilities where the last given biomarker time is at time 0, since this is used as a last evaluation time for each id. (see "reproducible steps" below for the logic behind this assertion).Within the call to
ll_event
, the introduction ofNaN
values occurs on the following line:Reproducible Steps:
(similar to those in #43):
Install fork with minor bugfixes, which builds off
develop2
branch of sambrilleman/rstanarmFit model using simulated data
run posterior_survfit on newdata
This yields the following (which may depend on the sample of
ids
given; here it was observed with id ==18
of pbcSurv):Running
ll_event
in debug mode for patient 18:where
etimes
is 0 andqtimes
are 0:the error occurs on line 499 of log_lik.R, which reads:
obviously
log(qtimes)
cannot be evaluated.In this example, if you attempt to evaluate
posterior_survfit
excluding patient 18, the result works without error.Patient 18 is a patient whose only longitudinal measurement was taken at t == 0.
We can induce the same error in this subset by limiting our subset to use only longitudinal measures taken at baseline (time == 0):
(here, removing id 18 to show that it's sufficient to reproduce the error reported above)
RStanARM Version:
See above