# load the data
data("sysdata")
# time at which the surrogate is measured
t.0 = data.example$t.0
# time at which the primary outcome is measured
t = data.example$t
# observed survival time
xob = data.example$data$xob
# surrogate information at t.0
s.ob = data.example$data$s.ob
# event indicator
deltaob = data.example$data$deltaob
# treatment indicator
aob = data.example$data$aob
# main estimation function
# varind: whether to estimate variance; re:number of replications for resampling
out = pte.survival(xob, s.ob, deltaob, aob, t, t.0, varind=0, re=100)
# estimated PTE
out$pte.est
# estimated g1
out$g1.est
# estimated g2(s) at equally spaced s point
plot(out$sgrid, out$gs.est, type="l", xlab = "Surrogate Marker", ylab = "Optimal Transformation")
#The PTE result indicates that this is a moderate to high surrogate marker in this setting.
Run the code above in your browser using DataLab