Skip to content

Commit

Permalink
update pred conversion pipeop
Browse files Browse the repository at this point in the history
  • Loading branch information
studener committed Sep 26, 2024
1 parent 4d49fa3 commit d786d08
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion R/PipeOpPredRegrSurvPEM.R
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ PipeOpPredRegrSurvPEM = R6Class(
# From theory, convert hazards to surv as prod(1 - h(t))
rows_per_id = nrow(data) / length(unique(data$id))
surv = t(vapply(unique(data$id), function(unique_id) {
1 - cumsum(data[data$id == unique_id, ][["dt_hazard"]] * exp(data[data$id == unique_id, ][["offset"]]))
exp(-cumsum(data[data$id == unique_id, ][["dt_hazard"]] * exp(data[data$id == unique_id, ][["offset"]])))
}, numeric(rows_per_id)))

unique_end_times = sort(unique(data$tend))
Expand Down

0 comments on commit d786d08

Please sign in to comment.