ClaytonOakes: Clayton-Oakes model with piece-wise constant hazards

View source: R/claytonakes.R

ClaytonOakesR Documentation

Clayton-Oakes model with piece-wise constant hazards

Description

Clayton-Oakes frailty model

Usage

ClaytonOakes(
  formula,
  data = parent.frame(),
  cluster,
  var.formula = ~1,
  cuts = NULL,
  type = "piecewise",
  start,
  control = list(),
  var.invlink = exp,
  ...
)

Arguments

formula

formula specifying the marginal proportional (piecewise constant) hazard structure with the right-hand-side being a survival object (Surv) specifying the entry time (optional), the follow-up time, and event/censoring status at follow-up. The clustering can be specified using the special function cluster (see example below).

data

Data frame

cluster

Variable defining the clustering (if not given in the formula)

var.formula

Formula specifying the variance component structure (if not given via the cluster special function in the formula) using a linear model with log-link.

cuts

Cut points defining the piecewise constant hazard

type

when equal to two.stage, the Clayton-Oakes-Glidden estimator will be calculated via the timereg package

start

Optional starting values

control

Control parameters to the optimization routine

var.invlink

Inverse link function for variance structure model

...

Additional arguments

Author(s)

Klaus K. Holst

Examples

set.seed(1)
d <- subset(simClaytonOakes(500,4,2,1,stoptime=2,left=2),truncated)
e <- ClaytonOakes(survival::Surv(lefttime,time,status)~x+cluster(~1,cluster),
                  cuts=c(0,0.5,1,2),data=d)
e

d2 <- simClaytonOakes(500,4,2,1,stoptime=2,left=0)
d2$z <- rep(1,nrow(d2)); d2$z[d2$cluster%in%sample(d2$cluster,100)] <- 0
## Marginal=Cox Proportional Hazards model:
ts <- ClaytonOakes(survival::Surv(time,status)~timereg::prop(x)+cluster(~1,cluster),
                   data=d2,type="two.stage")
## Marginal=Aalens additive model:
ts2 <- ClaytonOakes(survival::Surv(time,status)~x+cluster(~1,cluster),
                    data=d2,type="two.stage")
## Marginal=Piecewise constant:
e2 <- ClaytonOakes(survival::Surv(time,status)~x+cluster(~-1+factor(z),cluster),
                   cuts=c(0,0.5,1,2),data=d2)
e2


e0 <- ClaytonOakes(survival::Surv(time,status)~cluster(~-1+factor(z),cluster),
                   cuts=c(0,0.5,1,2),data=d2)
ts0 <- ClaytonOakes(survival::Surv(time,status)~cluster(~1,cluster),
                   data=d2,type="two.stage")
plot(ts0)
plot(e0,add=TRUE)

e3 <- ClaytonOakes(survival::Surv(time,status)~x+cluster(~1,cluster),cuts=c(0,0.5,1,2),
                   data=d,var.invlink=identity)
e3

mets documentation built on Jan. 17, 2023, 5:12 p.m.