drizopoulos / JMbayes2

Extended Joint Models for Longitudinal and Survival Data
https://drizopoulos.github.io/JMbayes2/
79 stars 23 forks source link

Dynamic predictions: longitudinal outcome axis scale issue. #6

Closed RyanJField closed 3 years ago

RyanJField commented 3 years ago

Hi,

I have found a possible issue with the plot.predict_jm(), currently it uses the range of values from the predict function for the ylim values, however if I have a biomarker with a valid range from 1-50000 (or 1-11 on the log scale) and I use the log scale of that variable in the JM the plot.predict_jm() function produces the following graph:

log

Which is easy to interpret, however if I use fun_long = exp, to use the original biomarker scale I get the following plot in which the ylim makes the graph hard to interpret:

exp

It would be good if you could override the ylim for the longitudinal model(s) by specifying a custom range so the graph looks like this:

exp-fixed

Many Thanks.

drizopoulos commented 3 years ago

I see your point, and I will add a ylim argument to allow for finer control. With that being said, the reason why I have done it like this is to show the biomarker levels for this patient compared to the other patients in the dataset.

drizopoulos commented 3 years ago

The plot() method for predict_jm objects has gained the argument ylim_long_outcome_range that defaults to TRUE. If set to FALSE, the ylim is set according to the value of the specific subject being plotted.

Leweibo commented 2 years ago

I changed a little for the function plot.predict_jm

From

ry <- r range(preds, low, upp, na.rm = TRUE)

to

ry1 =  range(preds, low, upp, na.rm = TRUE) 
ry <-  range(ry1[1]*0.8,ry1[2]*1.2)   

And it looks much better to me.

drizopoulos commented 2 years ago

Thanks, I will try it.