addHazard {WeightCalibSurvival}R Documentation

Fit Additive Hazards Model from Nested Case-control Samples (NCC) using weight calibration

Description

This function fits the additive hazards model with time-varying coefficients and time-invariant coefficients from a nested case-control study with or without weight calibration.

Usage

addHazard(data, ncc.subset, outcome.var, time.vars, timeDep.covars, timeIndep.covars, 
          anc.covars, risk.time, risk.time0=0, nCntlPerCase=1,
          inclProb.var=NULL, nrisk.var=NULL, 
          print=1, min.inclProb=1e-6, control=NULL) 

Arguments

data

Data frame containing all the data for analysis.

ncc.subset

Logical vector giving the subjects in the nested case-control sample. The length must be equal to the number of rows in data.

outcome.var

Binary outcome variable in data (1 = case, 0 = non-case).

time.vars

One or two time-to-event variables in data.

timeDep.covars

Character vector of covariates with time-varying effects.

timeIndep.covars

Character vector of covariates with time-invariant effects.

anc.covars

NULL or a character vector of ancillary covariates used to impute missing values of timeDep.covars and timeIndep.covars for subjects not in the nested case-control sample. If NULL, then random noise will be used for the imputation (see details).

risk.time

Projection time for pure risk.

risk.time0

Initial projection time for pure risk. Only used time.vars contains two time variables. The default is 0.

nCntlPerCase

Number of controls per case. The default is 1.

inclProb.var

NULL or a variable in data giving the probability of being included in the nested case-control sample. This can be computed using the function multipleNCC::KMprob. If NULL, then it is internally computed based on outcome.var, time.vars, and nCntlPerCase. The default is NULL.

nrisk.var

NULL or a variable in data giving the number of at-risk subjects at each time. If NULL, thenit is internally computed based on outcome.var, time.vars, and nCntlPerCase. The default is NULL.

print

0 or 1 to print information. The default is 1.

min.inclProb

Positive value <= 1 giving the minimum inclusion probability for being in the nested case-control sample. Any inclusion probability less than min.inclProb will be set to min.inclProb. This cannot be 0, since weights will be formed by taking the reciprocals of the inclusion probabilities. The default is 1e-6.

control

See control.

Details

NOTE: If anc.covars = NULL, then a seed must be set in order to reproduce the results. See Step 1 below.

The algorithm is as follows:

Step 1: Obtain predictions for missing data
For any variable in timeDep.covars and timeIndep.covars with missing data from phase 1, fit a weighted generalized linear model among the nested case-control subjects (phase 2) with that variable as the outcome adjusting for the other covariates in timeDep.covars, timeIndep.covars and anc.covars. The weights in the model are the reciprocals of the inclusion probabilities (inclProb.var). If anc.covars = NULL, then runif(nrow(data)) will be used as an ancillary covariate.

Step 2: Create auxiliary statistics (influence functions)

Step 3: Calibrate the design weights

Step 4: Fit the additive hazards model with and without weight calibration.

Value

A list containing two lists: with.calibration and without.calibration. Each sublist contains the parameter estimates, standard errors, and other objects needed to estimate pure risk using addHazardPureRisk.

Author(s)

Yei Eun Shin syeeun@gmail.com

References

Shin YE, Pfeiffer RM Graubard BI, Gail MH. Weight calibration to improve efficiency for estimating pure risks from the additive hazards model with the nested case-control design. Biometrics. 2020;1-13. https://doi.org/10.1111/biom.13413

See Also

coxHazard, diagnosticTests

Examples


  data(sample_data, package="WeightCalibSurvival")

  # Set the input arguments
  ncc.subset       <- sample_data[, "ind.ph2"] 
  outcome.var      <- "ind.fail"
  time.vars        <- "eventime"
  timeDep.covars   <- c("X1", "X2")
  timeIndep.covars <- c("Z1", "Z2")
  anc.covars       <- "U"
  risk.time        <- 8
  inclProb.var     <- "incl.prob"
  nrisk.var        <- "nrisk"

  addHazard(sample_data, ncc.subset, outcome.var, time.vars, timeDep.covars, timeIndep.covars, 
            anc.covars, risk.time, inclProb.var=inclProb.var, nrisk.var=nrisk.var)

[Package WeightCalibSurvival version 1.0.0 Index]