Questions tagged [hazard]

The Hazard function is used in survival analysis. It is the estimated number of events divided by the number of persons or units at risk for the particualr event per unit time.

59 questions
1
vote
1 answer

Dfmacox and SmoothHr: errors in running codes

I am trying to run a code for a statistical analysis from my dataset (non parametric estimate of hazard ratio curves for continuous predictors). This is my dataset: db2 <-structure(list(IBM = c(2, 3, 2, 5, 0, 0, 3, 0, 0, 4, …
John M.
  • 51
  • 5
1
vote
1 answer

Is it possible to run a Cox-Proportional-Hazards-Model with an exponential distribution for the baseline hazard in `lifelines` or another package?

I consider using the lifelines package to fit a Cox-Proportional-Hazards-Model. I read that lifelines uses a nonparametric approach to fit the baseline hazard, which results in different baseline_hazards for some time points (see code example…
Qaswed
  • 3,649
  • 7
  • 27
  • 47
1
vote
0 answers

How to plot the hazard function from survival data?

Goal I am trying to plot the hazard function of survival data in R. Attempt I am using the NCCTG lung cancer dataset in the survival package in R. In my understanding the hazard function has the following form: h(t) = h0(t) * e^(b1 * x1 + ... + bn *…
user213544
  • 2,046
  • 3
  • 22
  • 52
1
vote
1 answer

Error in coxModelFrame.coxph(object) : invalid object set x=TRUE in the call to coxph

The following example is for anyone who is building a Cox Proportional Hazards models and trying to produce prediction error curves, but get an error stating: Error in coxModelFrame.coxph(object) : invalid object set x=TRUE in the call to…
Brandon
  • 51
  • 1
  • 7
1
vote
0 answers

How to compare hazard ratios of different levels in Cox regression from R output?

I've run a Cox regression model with a categorical predictor and I'm not sure whether I can compare the different levels to each other, or just to the reference category? For example, in the lung…
Mildred
  • 11
  • 2
1
vote
0 answers

model to evaluate disease worsening/improvement after a therapy change

I have some experience with regression analysis, cox models etc., but I would like to ask which model would suite best to evaluate a chronic disease symptomatic control associated with different drug changes. Suppose you have a time-series data for…
cccnrc
  • 1,195
  • 11
  • 27
1
vote
1 answer

Basic Calculations with stat_functions -- Plotting hazard functions

I am currently trying to plot some density distributions functions with R's ggplot2. I have the following code: f <- stat_function(fun="dweibull", args=list("shape"=1), "x" = c(0,10)) stat_F <-…
KyuMirthu
  • 377
  • 3
  • 13
1
vote
1 answer

Coxph direction of Hazard Ratio

Let's assume I have the following dataset: time censor treatment 6 0 A 12 1 A 4 0 B 5 0 B 3 0 C 12 1 C 6 0 B 12 1 C 4 0 A 5 0 C 3 0 B 12 1 A so what I did is relevel to my reference A and ran: coxph(Surv(time,censor)~treatment) I looked at the…
Nuke
  • 83
  • 1
  • 9
1
vote
2 answers

How to extract the baseline hazard function h0(t) from glmnet object in R?

Extract the baseline hazard function h0(t) from glmnet object I want to know the hazard function at time t >> h(t,X) = h0(t) exp[Σ βi*Xi]. How can I extract the baseline hazard function h0(t) from glmnet object in R? What I know is that function…
Jr Pang
  • 11
  • 3
0
votes
0 answers

Change Text within ggplot Object using forester package

I am trying to make a table of odds ratios using the forester package. MTX is my "referent" category, so I want it to have an OR of 1 and no confidence intervals. To do that I'm assigning it a value of "1" for the "Estimate" paramater. This works…
0
votes
0 answers

How to calculate HR and 95% CI with different bases in a multi-arm study?

There is a multi-arm study, which reported HR and its 95% CI for arm A, arm B, arm C vs. control, respectively.(Example data line 1-3, SFC/Salmeterol/Fluticasone vs. Placebo) Question 1: how to calculate HR and its 95% for the rest pairwise…
tomasz
  • 39
  • 5
0
votes
0 answers

How to plot hazard function for coxme object?

Using the bshazard(), I can plot a hazard curve as follows: # Model Fit fit <- bshazard(Surv(enter, exit, event) ~ 1, df) # Plot df_surv <- data.frame(time = fit$time, hazard = fit$hazard, lower.ci = fit$lower.ci, upper.ci =…
0
votes
0 answers

How can I plot the hazard function for a coxreg() object using the eha package?

Using the eha package, it is possible to plot coxreg() objects. One of the parameters of plot.coxreg is fn = c("cum", "surv", "log", "loglog"). The argument "cum" gives the plot for the cumulative hazard function as shown here, using the following…
Cloft X
  • 141
  • 7
0
votes
0 answers

How can I plot the hazard function for a coxreg() object using the eha package?

Using the eha package, it is possible to plot coxreg() objects. One of the parameters of plot.coxreg is fn = c("cum", "surv", "log", "loglog"). The argument "cum" gives the plot for the cumulative hazard function as shown here, using the following…
Cloft X
  • 141
  • 7
0
votes
1 answer

How to plot hazard function in R using ggplot2?

There's a book called "Event History Analysis with R" by G. Broström. But it provides minimal R code for whatever concepts are presented. I'd like to plot a hazard function, how do I do that? I want the exact same plots as given here. The plots…
Cloft X
  • 141
  • 7