kkholst / mets

Analysis of Multivariate Event Times https://kkholst.github.io/mets/
15 stars 3 forks source link

error in predict.phreg function in mets #2

Closed YushuShi closed 3 years ago

YushuShi commented 3 years ago

I am building an R shiny app and it uses your R package mets. When I tried to use predict with the outcome from phreg, it gives me error. Error in Xs %*% varbeta : requires numeric/complex matrix/vector arguments

library(survival) library(mets) load("bcdeter.RData")

mCox <- phreg(Surv(lower, upper, type="interval2") ~ cont, data = bcdeter) summary(mCox) newdata<-data.frame(cont=seq(-1,2,by=0.5)) predictC<-predict(mCox,newdata=newdata, times=seq(0,45,by=5))

predictC

kkholst commented 3 years ago

A bug in the print function for the predict object has now been fixed (in the devel branch, about to be submitted to CRAN). Please note that the phreg function is only intended for right censored data, so your code is likely not doing what you intended it to do. You might instead consider a parametric model using the survreg function or the icenReg package.