CoxPoly: This is a function to implement polynomial Cox regression for...

View source: R/CoxPoly.R

CoxPolyR Documentation

This is a function to implement polynomial Cox regression for latency analysis

Description

This is a function to implement polynomial Cox regression for latency analysis

Usage

CoxPoly(
  data,
  time_start,
  time_end,
  status,
  exposure,
  degree,
  latency,
  adjusted_variable = NULL,
  adjusted_model = NULL,
  id = "id"
)

Arguments

data

A data frame containing the data

time_start

start time

time_end

end time

status

survival status. 1 for death and 0 for censored

exposure

Name of the time-varying exposure variable. From the most recent to the furthest in time.

degree

degree of the polynomial

latency

prespecified latency

adjusted_variable

A vector of adjusted variables

adjusted_model

A vector of adjusted models

id

A string to specify the name of the id column

Value

A Cox model object

Examples

time_start <- "age_start"
time_end <- "age_end"
status <- "failure"
exposure <- paste0("lag", 0:19)
degree <- 3
latency <- 20
fit <- CoxPoly(sim_data, time_start, time_end, status, exposure, degree, latency)
fit

LatencyA documentation built on Oct. 21, 2026, 5:14 p.m.