We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 54715ec commit 863ebf7Copy full SHA for 863ebf7
1 file changed
R/outcome_models.R
@@ -367,12 +367,15 @@ outcome_phreg <- function(data,
367
timemod <- proc_phreg(model)
368
model <- timemod$model
369
if (is.null(cens.model)) {
370
- if (is.null(model)) stop(
+ if (is.null(model)) {
371
+ stop(
372
"Need 'phreg' object (argument 'model') or specify parametric model"
- )
373
- fcens <- with(model, Surv(time, !status) ~ 1)
374
- cens.model <- mets::phreg(fcens, data = model.frame(model))
375
- cens.lp <- ~fcens
+ )
+ }
+ fcens <- Surv(time, !status) ~ 1
376
+ newd <- with(model, data.frame(time, status))
377
+ cens.model <- mets::phreg(fcens, data = newd)
378
+ cens.lp <- fcens
379
}
380
censmod <- proc_phreg(cens.model)
381
cens.model <- censmod$model
0 commit comments