Skip to content

Rename getSurvival to getCox - #166

Open
0xMuluh wants to merge 7 commits into
develfrom
cox
Open

0xMuluh wants to merge 7 commits into
develfrom
cox

Conversation

@0xMuluh

@0xMuluh 0xMuluh commented Nov 10, 2026

Copy link
Copy Markdown
Contributor

Follows the review on #112: getSurvival() and addSurvival() are now getCox() and addCox(), nvar is max.features, and the examples summarise and plot the results. Closes #93.

@0xMuluh 0xMuluh mentioned this pull request Nov 10, 2026
@0xMuluh 0xMuluh mentioned this pull request Dec 3, 2026
Comment thread R/AllGenerics.R
standardGeneric("addStability"))

#' @rdname getSurvival
#' @rdname getCox

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This must be deprecated. There could be deprecate.R file that has these deprecated functions.

That deprecated function could have nvar as an argument as it is also now changed.

Comment thread R/getCox.R Outdated
Comment on lines +127 to +141
#' # The coefficients
#' op <- par(mar = c(4, 14, 1, 1))
#' barplot(coefs, horiz = TRUE, las = 1, xlab = "Coefficient")
#' par(op)
#'
#' # Time to event of samples with risk scores above and below the median;
#' # the scores come from the data the model was fitted to, so the separation
#' # is optimistic
#' df <- data.frame(time = tse$event_time, event = tse$event,
#' risk = ifelse(tse$cox_risk_score > median(tse$cox_risk_score),
#' "high", "low"))
#' km <- survival::survfit(survival::Surv(time, event) ~ risk, data = df)
#' plot(km, col = c("red", "blue"), xlab = "Time", ylab = "Without event")
#' legend("bottomleft", legend = c("high risk", "low risk"),
#' col = c("red", "blue"), lty = 1)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For these, there could be simple plotting function that return ggplot object.

E.g., getCox() could return specific class (e.g., "miatime_cox"), then generic plot() function could be utilized.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

survival analysis

2 participants