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 |
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 |
infl2 |
matrix with the phase-two influences on the parameter. Needs to be
provided if |
cohort |
If |
stratified |
was the sampling of the case-cohort stratified on |
variance.phase2 |
should the phase-two variance component also be returned?
Default is |
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)