Title: Two Stage Residual Inclusion Additive Hazards Estimator
Version: 1.0.0
Description: Additive hazards models with two stage residual inclusion method are fitted under either survival data or competing risks data. The estimator incorporates an instrumental variable and therefore can recover causal estimand in the presence of unmeasured confounding under some assumptions. A.Ying, R. Xu and J. Murphy. (2019) <doi:10.1002/sim.8071>.
Depends: R (≥ 3.5.0)
Imports: survival
License: LGPL-2 | LGPL-2.1 | LGPL-3 [expanded from: LGPL (≥ 2)]
Encoding: UTF-8
URL: https://onlinelibrary.wiley.com/doi/abs/10.1002/sim.8071
LazyData: true
RoxygenNote: 6.1.1
NeedsCompilation: no
Packaged: 2020-04-23 20:06:44 UTC; andrewying
Author: Andrew Ying [aut, cre]
Maintainer: Andrew Ying <aying9339@gmail.com>
Repository: CRAN
Date/Publication: 2020-04-28 10:50:02 UTC

Plotting Predicted Survival Function or Cumulative Incidence Function with Pointwise Confidence Intervals

Description

The function will plot the predicted survival function when fitting a survival model and the predicted cumulative incidence function when fitting a competing risks model. Corresponding pointwise confidence intervals at level alpha are also included.

Usage

## S3 method for class 'tsriadditive'
plot(x, newtreatment = NULL, newIV = NULL,
  newcovariates = NULL, alpha = 0.05, unit = "", ...)

Arguments

x

the fitting object after fitting our model

newtreatment

a new treatment value

newIV

a new instrumental variable value

newcovariates

a new observed covariates

alpha

the confidence level 1 - alpha for confidence interval

unit

the time unit we focus

...

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

Value

No return value, called for side effects

Examples

survtime <- rexp(100)
cause <- rbinom(100, 1, 0.7)
treatment <- rbinom(100, 1, 0.5)
IV <- rnorm(100)
covariates <- rnorm(100)
fit <- tsriadditive(survtime, cause, treatment, IV, covariates)
plot(fit, 1, 0, 0)

Predict method for Additive Hazards Model with Two Stage Residual Inclusion Method Fits

Description

Predicted values based on tsriadditive object.

Usage

## S3 method for class 'tsriadditive'
predict(object, newtreatment = NULL,
  newIV = NULL, newcovariates = NULL, ...)

Arguments

object

an object of class "tsriadditive", usually, a result of a call to tsriadditive.

newtreatment

a new treatment value.

newIV

a new instrumental variable value.

newcovariates

a new observed covariates.

...

further arguments passed to or from other methods.

Value

predict.tsriadditive produces a venctor of predictions based on new values. A list with the following components is returned:

newobsz

the vector grouping newtreatment, new IV and newcovariates

score_pred

the predicted scores

hazard_pred

the predicted baseline hazards function

surival_pred

the predicted surival function

Examples

survtime <- rexp(100)
cause <- rbinom(100, 1, 0.7)
treatment <- rbinom(100, 1, 0.5)
IV <- rnorm(100)
covariates <- rnorm(100)
fit <- tsriadditive(survtime, cause, treatment, IV, covariates)
predict(fit, 1, 0, 0)

Summarizing Additive Hazards Model with Two Stage Residual Inclusion Method Fits

Description

summary method for class "tsriadditive".

Usage

## S3 method for class 'tsriadditive'
summary(object, ...)

## S3 method for class 'summary.tsriadditive'
print(x, ...)

Arguments

object

an object of class "tsriadditive", usually, a result of a call to tsriadditive.

...

further arguments passed to or from other methods.

x

an object of class "summary.tsriadditive", usually, a result of a call to summary.tsriadditive.

Value

print.summary.lm tries to be smart about formatting coefficients, an estimated variance covariance matrix of the coeffieients, Z-values and the corresponding P-values

Examples

survtime <- rexp(100)
cause <- rbinom(100, 1, 0.7)
treatment <- rbinom(100, 1, 0.5)
IV <- rnorm(100)
covariates <- rnorm(100)
fit <- tsriadditive(survtime, cause, treatment, IV, covariates)
summary(fit)

Fitting Additive Hazards Models with Two Stage Residual Inclusion Method

Description

tsriadditive is used to fit additive hazards models with two stage residual inclusion method.

Usage

tsriadditive(survtime, cause = NULL, treatment = NULL, IV = NULL,
  covariates = NULL)

Arguments

survtime

the event time

cause

the indicator records the cause. Default to all one. Zero means right censoring. Greater than or equal to two means other cause.

treatment

the treatment variable, can be null

IV

the instrumental variable

covariates

all the observed confounders

Value

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

coef

an estimate of the coefficients

baseline

an estimate of the baseline hazards function

vcov

an estimate of the variance covariance matrix of coef

byprod

a byproduct, that will used by other functions

References

Ying, A., Xu, R. and Murphy, J. Two-Stage Residual Inclusion for Survival Data and Competing Risks - An Instrumental Variable Approach with Application to SEER- Medicare Linked Data. Statistics in Medicine, 38(10): 1775-1801, 2019.

Examples

survtime <- rexp(100)
cause <- rbinom(100, 1, 0.7)
treatment <- rbinom(100, 1, 0.5)
IV <- rnorm(100)
covariates <- rnorm(100)
fit <- tsriadditive(survtime, cause, treatment, IV, covariates)