You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's a bug when we try to specify formula_time = ~1 in fitSmoothHazard.fit. This would happen, for example, if we assumed an exponential hazard.
library(casebase)
#> See example usage at http://sahirbhatnagar.com/casebase/N<-1000; p<-30nzc<-0.33*px<-matrix(rnorm(N*p), N, p)
dimnames(x)[[2]] <- paste0("x", seq_len(p))
beta<- rnorm(nzc)
fx<-x[, seq(nzc)] %*% (0.33*beta)
hx<- exp(fx)
ty<- rexp(N, hx)
tcens<- rbinom(n=N,
prob=0.3,
size=1) # censoring indicatory<- cbind(time=ty, status=1-tcens)
# This one worksout1<- fitSmoothHazard.fit(x, y, time="time",
event="status",
ratio=10,
formula_time=~time)
# This one doesn'tout2<- fitSmoothHazard.fit(x, y, time="time",
event="status",
ratio=10,
formula_time=~1)
#> Error in fitSmoothHazard.fit(x, y, time = "time", event = "status", ratio = 10, : length(timeVar) == 1 is not TRUE
There's a bug when we try to specify
formula_time = ~1
infitSmoothHazard.fit
. This would happen, for example, if we assumed an exponential hazard.Created on 2021-07-08 by the reprex package (v2.0.0)
It should be fairly easy to fix. The culprit are these lines here:
casebase/R/fitting.R
Lines 274 to 276 in c4d208c
When
formula_time = ~1
, we end up withtimeVar = character(0)
, hence the error.The text was updated successfully, but these errors were encountered: