estimate_truncatedscore: Estimation of mean clinical outcome truncated by event...

View source: R/truncatedscore.R

estimate_truncatedscoreR Documentation

Estimation of mean clinical outcome truncated by event process

Description

Let Y denote the clinical outcome, A the binary treatment variable, X baseline covariates, T the failure time, and epsilon=1,2 the cause of failure. The following are our two target parameters

E(Y|T>t, A=1)- E(Y|T>t, A=0)

P(T<t,\epsilon=1|A=1)- P(T<t,\epsilon=1|A=0)

Usage

estimate_truncatedscore(
  data,
  mod.y,
  mod.r,
  mod.a,
  mod.event,
  time,
  cause = NULL,
  cens.code = 0,
  naive = FALSE,
  control = list(),
  ...
)

Arguments

data

(data.frame)

mod.y

(formula or learner) Model for clinical outcome given T>time. Using a formula specifies a glm with an identity link (see example).

mod.r

(formula or learner) Model for missing data mechanism for clinical outcome at T=time. Using a formula specifies a glm with a log link.

mod.a

(formula or learner) Treatment model (in RCT should just be 'a ~ 1'). Using a formula specifies a glm with a log link.

mod.event

(formula) Model for time-to-event process ('Event(time,status) ~ x').

time

(numeric) Landmark time.

cause

(integer) Primary event (in the 'status' variable of the 'Event' statement).

cens.code

(integer) Censoring code.

naive

(logical) If TRUE, the unadjusted estimates ignoring baseline covariates is returned as the attribute 'naive'.

control

(list) optimization routine parameters.

...

Additional arguments passed to mets::binregATE.

Value

lava::estimate.default object

Author(s)

Klaus Kähler Holst

Examples

data(truncatedscore)
mod1 <- learner_glm(y ~ a * (x1 + x2))
mod2 <- learner_glm(r ~ a * (x1 + x2), family = binomial)
a <- estimate_truncatedscore(
  data = truncatedscore,
  mod.y = mod1,
  mod.r = mod2,
  mod.a = a ~ 1,
  mod.event = mets::Event(time, status) ~ x1+x2,
  time = 2
)
s <- summary(a, noninf.t = -0.1)
print(s)
parameter(s)

# the above is equivalent to
# a <- estimate_truncatedscore(
#   data = truncatedscore,
#   mod.y = y ~ a * (x1 + x2),
#   mod.r = r ~ a * (x1 + x2),
#   mod.a = a ~ 1,
#   mod.event = mets::Event(time, status) ~ x1+x2,
#   time = 2
# )

targeted documentation built on Jan. 12, 2026, 9:08 a.m.