View source: R/surv.to.logistic.r
surv.to.logistic | R Documentation |
The following function transforms the two-sample survival data into a logistic regression model with an offset.
surv.to.logistic(y, d, z, tcut = max(y[d == 1]))
y |
A vector of observed times. |
d |
A vector of event indicators with 1 denoting event and 0 denoting censoring. |
z |
A vector of group indicators with 1 being the treatment and 0 the control. |
tcut |
A constant as the cut-point. |
A dataframe for logistic regression with z denoting 1/0 outcome, y the (univariate) covariate and yset the offset.
n1=100;n2=100;n=n1+n0 zz=rep(0,n);zz[1:n1]=1 tt=c(rexp(n1)/0.1,rexp(n0)/0.2) cc=c(rexp(n1)/0.05,rexp(n0)/0.06) yy=pmin(tt,cc) dd=(tt<=yy) df=surv.to.logistic(y=yy,d=dd,z=zz,tcut=5)$adata
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.