hputter / mstate

https://hputter.github.io/mstate/
7 stars 5 forks source link

Filter error in plot.MarkovTest #28

Open liamhaller opened 7 months ago

liamhaller commented 7 months ago

When using plot.MarkovTest and selecting a subset of states it appears as if the states that are not selected are each designated as NA under qualset and then plotted together, rather than being filtered out of the dfr dataframe.

To reproduce the error see:

data("prothr")
# Apply Markov test to grid of monthly time points over the first 7.5 years
year <- 365.25
month <- year / 12
grid <- month * (1:90)
# Markov test for transition 1 (wild bootstrap based on 100 replications)
MT <- MarkovTest(prothr, id = "id", transition = 1,
                 grid = grid, B = 100)

plot(MT, grid, what="states", idx=1:50, states=1, #whenver it is less than all states the error occurs
     xlab="Days since randomisation", ylab="Log-rank test statistic",
     main="Transition Normal -> Low")