Skip to contents

Fit the additive hazards model for sparse longitudinal covariate data using a kernel estimating-equation approach.

Usage

kee_additive(
  formula,
  data,
  id,
  obs_times,
  h = NULL,
  lq_nodes = 64,
  one_sided = TRUE
)

Arguments

formula

A model formula with a survival::Surv() response.

data

Data frame containing all variables used in the fit.

id

Subject identifier aligned row-wise with data.

obs_times

Longitudinal observation times aligned row-wise with data. Times may be on any scale; the sieve basis and the cumulative-hazard quadrature are built on the observed follow-up, so there is no need to rescale to the unit interval first. h must be on the same scale.

h

Positive kernel bandwidth. If omitted, one is read off the observation times as a rule of thumb and reported in a message. Use skmle_cv() to choose it from the data.

lq_nodes

Number of quadrature nodes used in the numerical integration step.

one_sided

Logical. TRUE (the default) uses a half kernel: only covariate observations strictly before the event or quadrature time inform that time, which is the risk-set restriction and the estimator as published. FALSE uses a full, two-sided kernel, smoothing the covariate path from both sides. The switch applies to the risk-set averages inside the C++ backend as well as to the row weights, so the two are always consistent.

Value

An object of class kee containing coefficient estimates, an estimated variance-covariance matrix, intermediate matrices used for sandwich variance estimation, and model metadata.

Details

kee_additive() is the specialized additive-hazards counterpart to kee_cox(). It uses a kernel-smoothed martingale estimating equation and typically runs faster than the general skmle(s = 1) fit because it solves a more specialized problem.

References

Sun, Dayu, Zhuowei Sun, Xingqiu Zhao, and Hongyuan Cao. "Kernel Meets Sieve: Transformed Hazards Models with Sparse Longitudinal Covariates." Journal of the American Statistical Association (2025): 1-12.

Sun, Dayu, Hongyuan Cao, and Yining Chen. "Additive hazards models with sparse longitudinal covariates." Lifetime Data Analysis (2022).

Examples

# \donttest{
library(survival)

set.seed(123)
dat <- sim_skmle_data(
  n = 80,
  mu = function(tt) 8 * (0.75 + (0.5 - tt)^2),
  mu_bar = 8,
  alpha = function(tt) 0.75 + 0.75 * (tt * (1 - sin(2 * pi * (tt - 0.25)))),
  beta = c(1, -0.5),
  s = 1,
  cen = 0.7
)

fit_add <- kee_additive(
  Surv(X, delta) ~ covariates,
  data = dat,
  id = id,
  obs_times = obs_times,
  h = 0.5
)

summary(fit_add)
#> Call:
#> kee_additive(formula = Surv(X, delta) ~ covariates, data = dat, 
#>     id = id, obs_times = obs_times, h = 0.5)
#> 
#> Additive hazards, kernel estimating equation (half kernel)
#>   n= 80 subjects   bandwidth h = 0.5
#> 
#>             Estimate Std. Error z value Pr(>|z|)
#> covariates1  0.86274    0.67004  1.2876   0.1979
#> covariates2 -0.18020    0.65683 -0.2744   0.7838
# }