Closed jburos closed 7 years ago
For the record, if I run the same example converting the ids to characters:
pp_survfit <- posterior_survfit(f1,
newdataLong = newdataLong %>% dplyr::mutate(id = as.character(id)),
newdataEvent = newdataEvent %>% dplyr::mutate(id = as.character(id)))
I see the following state at line 385:
Browse[2]> id_list
[1] "34" "40" "30" "36" "2" "18" "17" "31" "13" "11"
Browse[2]> last_time
11 13 17 18 2 30 31 34 36 40
10.1136208 11.6167009 1.8425736 0.0000000 8.8323066 0.8186174 9.8288843 12.2026010 10.8309377 13.2648871
Again the sort order of the last_times does not match that of the ids and the same error is given.
I've just adopted your fix here, which is to re-order last_time according to id_list
Summary:
Seeing the following when trying to run
posterior_survfit
with newdataEvent & newdataLong.However, on inspection, this should not be the case. Below is an example where newdata are a subset of the original data passed in.
Description:
The error appears to occur within jm_data function code, but is based on the
last_times
argument inferred by posterior_predict. [note: this may be limited to the case where the ids given are numeric].Reproducible Steps:
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 is odd since these are a subset of the data used to fit the original model.
Running in
debug
mode on line 385 of posterior_survfit, I see the following:Code:
State:
So
last_time[[i]]
will be the value for id == 2, whereas the id given will be34
. So these aren't provided in the correct sort order.RStanARM Version:
minor fork off of
develop2
branch of this repo