knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(poreg)
require(survival)

Generate simulated data.

set.seed(123)
df = 10
nn = 1000
beta = c(0.5,0,-0.5, rep(0,10))
sim_PO_data = PO.sim(nn, beta,
                     C.gen = function(n)
                       5+rbinom(n,1,0.5)*runif(n, -5, 0))
str(sim_PO_data)

Use U-Method

res_umethod = PO(Surv(X, delta) ~ Z[,1]+ Z[,2]+ Z[,3]+ Z[,4]+ Z[,5]+ Z[,6]+ Z[,7]
         + Z[,8]+ Z[,9]+ Z[,10]+ Z[,11]+ Z[,12]+ Z[,13],
         data = sim_PO_data,method = 'U-method')
res_umethod$coefficients

Use NPMLE

res_npmle = PO(Surv(X, delta) ~ Z[,1]+ Z[,2]+ Z[,3]+ Z[,4]+ Z[,5]+ Z[,6]+ Z[,7]
         + Z[,8]+ Z[,9]+ Z[,10]+ Z[,11]+ Z[,12]+ Z[,13],
         data = sim_PO_data,method = 'NPMLE')
res_npmle$coefficients


celehs/poreg documentation built on May 15, 2022, 12:05 a.m.