tagteam / riskRegression

R package for risk regression and prediction with censored data
44 stars 17 forks source link

predict (and therefore plot) functions give strange results for objects of class "riskRegression" #47

Closed drs81 closed 1 year ago

drs81 commented 1 year ago

After fitting a riskRegression model, the predict (and therefore plot) functions dont appear to be working correctly.

Example

library(riskRegression) library(prodlim) data(Melanoma,package="riskRegression") fit.arr <- ARR(Hist(time,status)~sex,data=Melanoma,cause=1) fit.arr2 <- ARR(Hist(time,status)~sex + age,data=Melanoma,cause=1)

slot $risk from the list object returned by predict functions gives a bunch of ones

predict(fit.arr,newdata=data.frame(sex=c("Female","Male"))) predict(fit.arr2,newdata=data.frame(sex=c("Female","Male"), age = c(60,60)))

Example plot...

strange plot from predict

tagteam commented 1 year ago

this was a bug related to a change between two alternative parametrizations that timereg::comp.risk allow (rcif vs rcif2). I just pushed a fix to github. hope this works now.

drs81 commented 1 year ago

Great thanks for your prompt action Thomas.