variance {CaseCohortCoxSurvival}R Documentation

variance

Description

Computes the variance estimate that follows the complete variance decomposition, for a parameter such as log-relative hazard, cumulative baseline hazard or covariate specific pure-risk.

Usage

variance(n, casecohort, weights = NULL, infl, calibrated = NULL,
infl2 = NULL, cohort = NULL, stratified = NULL,
variance.phase2 = NULL)

Arguments

n

number of individuals in the whole cohort.

casecohort

If stratified = TRUE, data frame with status (case status), weights (design, if they are not provided in the argument below), W (the J strata), strata.m (vector of length J with the numbers of sampled individuals in the strata) and strata.n (vector of length J with the strata sizes in the cohort), for each individual in the stratified case-cohort data. If stratified = FALSE, data frame with weights (design, if they are not provided in the argument below), m (number of sampled individuals) and n (cohort size), for each individual in the unstratified case-cohort data.

weights

vector with design weights for the individuals in the case-cohort data.

infl

matrix with the overall influences on the parameter.

calibrated

are calibrated weights used for the estimation of the parameters? If calibrated = TRUE, the arguments below need to be provided. Default is FALSE.

infl2

matrix with the phase-two influences on the parameter. Needs to be provided if calibrated = TRUE.

cohort

If stratified = TRUE, data frame with status (case status) and subcohort (subcohort sampling indicators) for each individual in the stratified case-cohort data. If stratified = FALSE, data frame with status (case status) and unstrat.subcohort (subcohort unstratified sampling indicators) for each individual in the unstratified case-cohort data. Needs to be provided if calibrated = TRUE.

stratified

was the sampling of the case-cohort stratified on W? Default is FALSE.

variance.phase2

should the phase-two variance component also be returned? Default is FALSE.

Details

variance works for estimation from a case-cohort with design weights or calibrated weights (case-cohort consisting of the subcohort and cases not in the subcohort, i.e., case-cohort obtained from two phases of sampling).

If covariate information is missing for certain individuals in the phase-two data (i.e., case-cohort obtained from three phases of sampling), use variance.missingdata.

variance uses the variance formulas provided in Etievant and Gail (2024).

Value

variance: variance estimate.

variance.phase2: phase-two variance component.

References

Etievant, L., Gail, M. H. (2024). Cox model inference for relative hazard and pure risk from stratified weight-calibrated case-cohort data. Lifetime Data Analysis, 30, 572-599.

See Also

influences, influences.RH, influences.CumBH, influences.PR, robustvariance and variance.missingdata.

Examples


  data(dataexample.stratified, package="CaseCohortCoxSurvival")
  cohort <- dataexample.stratified$cohort
  casecohort <- cohort[which(cohort$status == 1 |
                       cohort$subcohort == 1),] # the stratified case-cohort
  casecohort$weights <- casecohort$strata.n / casecohort$strata.m
  casecohort$weights[which(casecohort$status == 1)] <- 1

  Tau1 <- 0
  Tau2 <- 8
  x <- c(-1, 1, -0.6) # given covariate profile for the pure risk
  n <- nrow(cohort)

  # Estimation using the stratified case-cohort with design weights
  mod <- coxph(Surv(event.time, status) ~ X1 + X2 + X3, data = casecohort,
               weight = weights, id = id, robust = TRUE)

  # parameters and influences estimation
  est           <- influences(mod, Tau1 = Tau1, Tau2 = Tau2, x = x)
  beta.hat      <- est$beta.hat
  Lambda0.hat   <- est$Lambda0.Tau1Tau2.hat
  Pi.x.hat      <- est$Pi.x.Tau1Tau2.hat
  infl.beta     <- est$infl.beta
  infl.Lambda0  <- est$infl.Lambda0.Tau1Tau2
  infl.Pi.x     <- est$infl.Pi.x.Tau1Tau2

  # variance estimate for the log-relative hazard estimate
  variance(n = n, casecohort = casecohort, infl = infl.beta, stratified = TRUE)

  # variance estimate for the cumulative baseline hazard estimate
  variance(n = n, casecohort = casecohort, infl = infl.Lambda0,
           stratified = TRUE)

  # variance estimate for the pure risk estimate
  variance(n = n, casecohort = casecohort, infl = infl.Pi.x, stratified = TRUE)


[Package CaseCohortCoxSurvival version 0.0.36 Index]