Package 'cmprskcoxmsm'

Title: Use IPW to Estimate Treatment Effect under Competing Risks
Description: Uses inverse probability weighting methods to estimate treatment effect under marginal structure model for the cause-specific hazard of competing risk events. Estimates also the cumulative incidence function (i.e. risk) of the potential outcomes, and provides inference on risk difference and risk ratio. Reference: Kalbfleisch & Prentice (2002)<doi:10.1002/9781118032985>; Hernan et al (2001)<doi:10.1198/016214501753168154>.
Authors: Yiran Zhang, Ronghui Xu
Maintainer: Yiran Zhang <[email protected]>
License: GPL (>= 2)
Version: 0.2.1
Built: 2024-11-20 06:52:37 UTC
Source: CRAN

Help Index


Estimated cumulative incidence function

Description

cif_est estimates the cumulative incidence function (CIF, i.e.risk) based on the cause-specific regression results with 95% confidence intervals, it also calculates the risk ratio and risk difference for the specific time point.

Usage

cif_est(data=,
        time, time2 = NULL,
        Event.var, Events, cif.event,
        weight.type,
        ties = NULL,
        risktab = TRUE, risk.time = NULL)

Arguments

data

The dataset, output of doPS

time

See weight_cause_cox.

time2

See weight_cause_cox.

Event.var

The variable name for the event indicator which typically has at least 3 levels.

Events

The vector of all the event name, the rest of levels in the Event.var will be treated as loss to follow up (i.e. right censoring).

cif.event

Value of event of interest for the CIF.

weight.type

See weight_cause_cox.

ties

See weight_cause_cox.

risktab

Indicator whether the risk ratio and risk difference table should be returned.

risk.time

If risktab, the specific time point for calculating the risk ratio and risk difference.

Details

After estimating the parameters in the cause-specific hazard λja\lambda_{j}^a using IPW, we could estimate the corresponding CIF:

P^(Ta<t,Ja=j)=0tS^a(u)dΛ^ja(u),\hat{P}(T^a<t,J^a=j) = \int_{0}^{t} \hat{S}^a(u) d\hat{\Lambda}_{j}^a(u),

where S^a\hat{S}^a is the estimated overall survial function for TaT^a, S^a(u)=ejΛ^ja(u)\hat{S}^a(u) = e^{-\sum_j\hat{\Lambda}_{j}^a(u)}, Λ^ja(u)=Λ^0j(u)eβ^a\hat\Lambda_{j}^a(u) = \hat\Lambda_{0j}(u)e^{\hat\beta*a}, and Λ^0j(u)\hat\Lambda_{0j}(u) is a Breslow-type estimator of the baseline cumulative hazard.

Value

Returns a table containing the estimated CIF for the event of interest for control and treated group and their 95% confidence intervals.

If risktab, will return the risk ratio and risk difference at time risk.time, and their 95% confidence intervals.

References

Hou, J., Paravati, A., Hou, J., Xu, R., & Murphy, J. (2018). “High-dimensional variable selection and prediction under competing risks with application to SEER-Medicare linked data,” Statistics in Medicine 37(24), 3486-3502.


Generate the Inverse Probability Treatment Weights

Description

doPS calculates the unstabilized and stabilized inverse probability treatment weights (IPW) for average treatment effect using propensity score. The propensity score is calculated by twang package using the boosted logistic regression.

Usage

doPS(data,Trt,Trt.name,VARS.)

Arguments

data

The dataset, includes treatment assignment as well as covariates

Trt

The name of the treatment variable in the dataset.

Trt.name

The treated group name of the treatment variable in the dataset.

VARS.

The vector of the name of potential confounding variables in the dataset.

Details

The treatment variable should only contain 2 levels of treatment, and one should be viewed as treated group and another is control group.

For stabilized weights:

For the treated individuals, we assign the IPW: w = Pr(T=1)/Pr(T=1|X=x), for control individuals, the stabilized weight is: w = (1-Pr(T=1))/(1-Pr(T=1|X=x)).

Value

doPS returns an object of class "PS". An object of class "PS" is a list containing the following components:

Data

A new dataset which excludes all the missing value on the potential confounders from input data, add the propensity score and IPW into the new dataset.

ps_ate

The estimated propensity scores with estimand of interest as ATE

ipw_ate_unstab

Unstabilized ipw calculated from ps_ate

ipw_ate_stab

Stabilized ipw calculated from ps_ate

ps

an object of class ps, See the help for ps for details of the ps class.

See Also

ps


Follicular cell lymphoma study

Description

Competing risk data set involving follicular cell lymphoma from Pintilie (2007)

Usage

data(follic)

Format

A data frame containing:

age

age

hgb

hemoglobin (g/l)

clinstg

clinical stage: 1=stage I, 2=stage II

ch

chemotherapy

rt

radiotherapy

time

first failure time

status

Reason of failure: 1: Relapse, 2: Death, 0: No response

References

Pintilie M., (2006) Competing Risks: A Practical Perspective. West Sussex: John Wiley and Sons.


ggplot method for cif_est objects

Description

This function produces a CIF plots for cif_est objects.

Usage

plot_est_cif(cif.data, color = color, ci.cif = FALSE)

Arguments

cif.data

The dataset, output of cif_est

color

Color for control and treatment group, has to be a vector of length 2.

ci.cif

Indicator whether to plot the 95% confidence interval area for the CIF.

Value

A cumulative incidence function plot (with 95% confidence interval area) corresponding to the output from cif_est.


Plotting histogram of propensity score and balancing plot for covariates in the propensity score model

Description

Displays a the histogram plots for the propensity score, stratified by treated and control group and a graph of standardized mean difference of potential confounders before and after weigthing.

Usage

## S3 method for class 'PS'
plot(x,...)

Arguments

x

The results of doPS function

...

the other arguments you want to put in the built-in plot function

Details

The standardized mean difference (SMD), defined as the (weighted) treatment group mean minus the (weighted) control group mean divided by the (weighted) pooled sample (treatment and control) standard deviation. SMD between -0.1 and 0.1 typically indicates good balance.

Value

Histogram of propensity score and balancing plot for covariates in the propensity score model corresponding to the output from doPS.

See Also

bal.table


Adjust p-value format

Description

Formats p-values for reports, can report adjusted pvalues

Usage

pvalFormat(p.values, method = 'none', replace = FALSE)

Arguments

p.values

p-value

method

pvalue adjustment, passed to p.adjust.methods

replace

if TRUE, replaces p-values with their adjusted value

Value

Return the formatted p-value: round the p-value, assign the significance sign to the p-value based on the significant level. Can be used directly to the LaTex report.

Examples

p <- 0.002354
print(p.1 <- pvalFormat(p))

Inverse probability weighted proportional cause-specific hazards model

Description

weight_cause_cox fits the marginal structural proportional cause-specific hazards model using the inverse probability treatment weights.

Usage

weight_cause_cox(data=,
                 time, time2 = NULL,
                 Event.var, Event,
                 weight.type,
                 ties = NULL)

Arguments

data

The dataset, output of doPS

time

See also Surv, for right censored data, this is the follow up time. For interval data, the first argument is the starting time for the interval.

time2

See also Surv, ending time of the interval for interval censored or counting process data only. Intervals are assumed to be open on the left and closed on the right, (start, end]. For counting process data, event indicates whether an event occurred at the end of the interval.

Event.var

The variable name for the event indicator which typically has at least 3 levels.

Event

Event of interest, the rest of the event are treating as competing event.

weight.type

Type of inverse probability weights. Possible values are "Unstabilized" and "Stabilized".

ties

See also coxph, a character string specifying the method for tie handling. If there are no tied death times all the methods are equivalent.

Details

The marginal structural cause-specific Cox model for cause j usually has the form:

λja(t)λTa,Ja=j(t)=λ0jeβa,\lambda^{a}_j (t) \equiv \lambda_{T^{a},J^{a}=j}(t) = \lambda_{0j}e^{\beta*a},

where TaT^{a}, JaJ^{a} is the counterfactural survival time and cause for treatment a(=0,1)a (=0,1), λ0j\lambda_{0j} is the unspecified baseline cause-specific hazard for cause j, and β\beta is the treatment effect.

Value

Returns a table containing the estimated coefficient of the treatment effect, the robust standard error of the coefficient, estimated hazard ratio and 95% CI for the hazard ratio.

See Also

coxph