surv.to.logistic: Transform the two-sample survival data into logistic...

View source: R/surv.to.logistic.r

surv.to.logisticR Documentation

Transform the two-sample survival data into logistic regression data

Description

The following function transforms the two-sample survival data into a logistic regression model with an offset.

Usage

surv.to.logistic(y, d, z, tcut = max(y[d == 1]))

Arguments

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.

Value

A dataframe for logistic regression with z denoting 1/0 outcome, y the (univariate) covariate and yset the offset.

Examples

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
 

marvels2031/PWEALL_1.4.0 documentation built on April 22, 2022, 12:52 a.m.