Learn R Programming

riskRegression (version 2022.09.23)

baseHaz_cpp: C++ Fast Baseline Hazard Estimation

Description

C++ function to estimate the baseline hazard from a Cox Model

Usage

baseHaz_cpp(
  starttimes,
  stoptimes,
  status,
  eXb,
  strata,
  predtimes,
  emaxtimes,
  nPatients,
  nStrata,
  cause,
  Efron
)

Arguments

starttimes

a vector of times (begin at risk period).

stoptimes

a vector of times (end at risk period).

status

a vector indicating censoring or event.

eXb

a numeric vector (exponential of the linear predictor).

strata

a vector of integers (index of the strata for each observation).

predtimes

a vector of times (time at which to evaluate the hazard). Must be sorted.

emaxtimes

another vector of times, one per strata (last observation time in each strata).

nPatients

number of observations.

nStrata

number of strata

cause

the status value corresponding to event.

Efron

whether Efron or Breslow estimator should be used in presence of ties.

Details

WARNING stoptimes status eXb and strata must be sorted by strata, stoptimes, and status