Questions tagged [survival]

Survival analysis compares the statistical strength of predictors for events encoded as occuring or censored in concert with a time variable. It can be parametric or non-parametric.

445 questions
0
votes
1 answer

'Undefined columns selected' error when trying to calculate population attributable risk from a Cox model (using AF::AFcoxph in R)?

For a current project i am trying to calculate the population attributable risk using Hazards obtained from a Cox proportional hazards model. There is a function in the package AF that does this specifically (link). However, when I try to run the…
tcvdb1992
  • 413
  • 3
  • 12
0
votes
0 answers

Create groups based on survival

I have survival data from about 100 patients. I would like to divide my cohort into 2 groups: a group of 50% of the best surviving patients and a group of 50% of the worst surviving patients. How do I do this? Thanks Alex
0
votes
1 answer

How can i calculate median survival adjusted for covariates (age, gender and other covariates)

I am doing a study on a disease. I have done KM-plot, and cox analysis. However I can not figure out how i can calculate the median survival adjusted for age, gender and other covariates. This is interessting because I have four different…
0
votes
0 answers

Mantel Haenszel stratified estimates in survival data in R?

I've got survival data with an outcome, an exposure, and a variable I'd like to stratify on but can't find a function to perform Mantel-Haenszel rate ratio. For example with the lung dataset from survival I'd like to look at the outcome of status…
pgcudahy
  • 1,542
  • 13
  • 36
0
votes
0 answers

Is there a way to get confidence intervals for survival risk ratios in R?

In STATA with stmh I can get stratified rate ratios between two groups in a survival analysis as well as get a 95% confidence interval, chi-square, and p-value for that ratio. Is there anything similar in R? So far I've gotten this far. Using the…
pgcudahy
  • 1,542
  • 13
  • 36
0
votes
1 answer

custom code for compact letter display from pairwise table output

I would like to create a custom code that creates a compact letter display from a pairwise test I have performed. I have done this with pairwise t-tests with success (packages for this exist), and I am also familiar with the package…
Andy
  • 413
  • 2
  • 15
0
votes
0 answers

NAs produced when creating time-dependent covariates with survival::tmerge()

I have a question related to the function tmerge() in the R package survival. Trying to set up a data set with time-dependent covariates, but the value(s) of the initial time period is set to NA (see reprex below). I have one data frame with…
mejoh
  • 1
0
votes
1 answer

Survival::Survfit (left, right, and interval censoring)

I'm attempting to estimate survival probabilities using the survfit function from the Survival package. My dataset consists of animals that were captured at various times over the course of ~2 years. Some animals died, some animals were censored…
Eric
  • 1
0
votes
1 answer

Why are my survival curves not displaying as stratified categories?

First time poster so I hope I've enough information here. I'm trying to show my survival curves in 4 categories. The analysis is stratified according to my 4 categories in survival tables, but the survival plots do not depict these 4 categories and…
Jobolo
  • 79
  • 6
0
votes
1 answer

Plotting Hazard Function with bshazard package + Hazard ratios in life table

I'm trying to plot the hazard function of a survival analysis I'm doing for my PhD, comparing the hazard rate of two different conditions. I can't find a way to make the code function as intended (here for reference, Fig. 4, page 7), in order to…
0
votes
1 answer

ggforest error - undefined columns selected

I am trying to make a forrest plot for my model with ggforest(). Here is the code to create mock data to reproduce the problem. Data is formatted according to Therneau for time dependent covariates. I guess this might be the reason why ggforest does…
0
votes
0 answers

Uncollapse Data for Survival Analysis SAS

I have data that looks like this: where month is the number of months that have passed, vegetable is a category of interests, and n_spoiled is the number of vegetables from that category that spoiled after x amount of months. I am interested in…
0
votes
0 answers

Questions about calibrate.cph function in rms package

I have made a cph model using survival:coxph (see below) I am now having some difficulties using the model performance functions in the rms package. I keep on hitting this error when running the code: Error in if (unit == "") unit <- "Day" :…
0
votes
2 answers

Reconstruct survival curve from coordinates

Below is a dataset I extracted from a survfit object using the survival package. > km_data <- data.table(time = c(72, 109, 143), n.risk = c(80, 77, 76), n.event = c(1, 1, 2), n.censor = c(3, 2,…
lil_barnacle
  • 168
  • 7
0
votes
1 answer

2 survival functions, 1 left-truncated, 1 not truncated. How create survival function in R that assumes same experience over the truncated interval?

I have two survival functions, one is not truncated so I have experience for all time periods. The other is left-truncated until t = 4, so it has no experience until t > 4. I can plot the two together in the following code in R using the survival…
AndrewT
  • 25
  • 4