Package 'tsriadditive'

Title: Two Stage Residual Inclusion Additive Hazards Estimator
Description: Programs for A.Ying, R. Xu and J. Murphy. 'Two-Stage Residual Inclusion under the Additive Hazards Model - An Instrumental Variable Approach with Application to SEER-Medicare Linked Data.' Statistics in Medicine, to appear, 2018.
Authors: Andrew Ying [aut, cre]
Maintainer: Andrew Ying <[email protected]>
License: LGPL (>= 2)
Version: 1.0.0
Built: 2025-01-21 03:23:54 UTC
Source: https://github.com/andrewyyp/tsriadditive

Help Index


The baseline hazards function

Description

This gives the estimate of baseline hazards function

Usage

baselineest(cause, s_zero, Z_int, coef_est)

Arguments

cause

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

s_zero

the S_zero in the paper

Z_int

the integration of Z_bar

coef_est

the coefficent estimate from the fit

Value

the baseline hazard function estimate


the confidence interval for our beta estimator

Description

the confidence interval for our beta estimator

Usage

betaconfint(coef_est, vcov, alpha)

Arguments

coef_est

the estimate for beta

vcov

the variance covariance matrix for beta estimate

alpha

the prespecified level

Value

a list containing the (1 - alpha) level confidence interval


betavarest function

Description

This gives the variance estiamte for heta

Usage

betavarest(fit)

Arguments

fit

the fitting object after fitting our model

Value

the variance matrix of finite dimensional parameter part


The finite dimensional coefficients estimator

Description

This function returns us the estimate the finite dimensional part

Usage

coefest(N, omega_inv, score_process)

Arguments

N

the sample size

omega_inv

the inverse of omega matrix in the paper

score_process

the score process in the paper

Value

the coefficent estimate from the fit


Dhatt function

Description

This prepares for the variance estiamte of baseline hazards function

Usage

Dhatt(fit)

Arguments

fit

the fitting object after fitting our model

Value

D_hat part in the paper


Ehatt function

Description

This prepares for the variance estiamte of baseline hazards function

Usage

Ehatt(fit, i)

Arguments

fit

the fitting object after fitting our model

i

the ith round of our data

Value

an integrated function with speed O(n) by recording each time result


EThetaEpart function

Description

This prepares for the variance estiamte of baseline hazards function

Usage

EThetaEpart(fit)

Arguments

fit

the fitting object after fitting our model

Value

E_Theta_E part in the paper


Ghatt function

Description

This prepares for the variance estiamte of baseline hazards function

Usage

Ghatt(fit, newobsz)

Arguments

fit

the fitting object after fitting our model

newobsz

the new obtained Z value

Value

G_hat in the paper, the only part that changes with newobsz


Gint function

Description

This is the integration of our censorsurv from somewhere to infinity

Usage

Gint(survtime, censorsurv)

Arguments

survtime

the event time

censorsurv

the estimate for the censoring distribution


GZ_int function

Description

This is the integration of our censorsurv from somewhere to infinity

Usage

GZint(survtime, Z_bar, censorsurv)

Arguments

survtime

the event time

Z_bar

defined in the paper

censorsurv

the estimate for the censoring distribution


A hazard prediction function

Description

the predict function associated with our class

Usage

hazardpred(fit, newtreatment = NULL, newIV = NULL,
  newcovariates = NULL)

Arguments

fit

the fitting object after fitting our model

newtreatment

the new treatment value

newIV

new instrumental variable value

newcovariates

new observed covariates

Value

an object recording the corresponding predicted survival curve and corresponding pointwise confidence interval


hazardpredvarest function

Description

This gives the variance estimate for our prediction of the hazard function

Usage

hazardpredvarest(newobsz, fit = NULL)

Arguments

newobsz

the new obtained Z value

fit

the fitting object after fitting our model

Value

the variance of hazard function at each time point


leadpart function

Description

This prepares for the variance estiamte of baseline hazards function

Usage

leadpart(fit)

Arguments

fit

the fitting object after fitting our model

Value

the leading part in our variance estimate


the pointwise lower confidence interval for the survival curve

Description

the pointwise lower confidence interval for the survival curve

Usage

lowerconfint(hazard_pred, hazardpredvar_est, newobsz, alpha)

Arguments

hazard_pred

the predicted hazard function

hazardpredvar_est

the variance of the estimator of the hazard function

newobsz

the new obtained Z value

alpha

the prespecified level

Value

the lower (1 - alpha) level pointwise confidence interval for the hazard function


Omega inverse function

Description

This is for inverse of omega, which is part of the sandwich estimator

Usage

omegainv(N, survtime, Z, Z_int, cause, comp = FALSE, censorsurv = NULL,
  G_int = NULL, GZ_int = NULL)

Arguments

N

the sample size

survtime

the event time

Z

a variable contains all the regressors

Z_int

the integration of Z_bar

cause

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

comp

indicator of whether we are under competing risks setting

censorsurv

the estimate for the censoring distribution

G_int

the integration of G function

GZ_int

the integration of GZ

Value

the Omega matrix appear in the paper


pihatt function

Description

This gives the pihatt part in the sigmathree estiamte

Usage

pihatt(fit)

Arguments

fit

the fitting object after fitting our model

Value

pi_hatt part in sigma_three, only appears in competing risks setting, in the paper


plot function associated with our class

Description

this function will plot the predicted curve and corresponding pointwise confidence interval at level alpha

Usage

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

Arguments

fit

the fitting object after fitting our model

newtreatment

the new treatment value

newIV

new instrumental variable value

newcovariates

new observed covariates

alpha

the level for confidence interval

unit

the time unit we focus

...

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


the predict function associated with our class

Description

the predict function associated with our class

Usage

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

Arguments

fit

the fitting object after fitting our model

newtreatment

the new treatment value

newIV

new instrumental variable value

newcovariates

new observed covariates

Value

an object recording the corresponding predicted survival curve and corresponding pointwise confidence interval


the print function associated with our class

Description

This function will print our coefficients, the variance covariance matrix of the coeffieients, and the estimate for the baseline hazard function

Usage

## S3 method for class 'tsriadditive'
print(fit)

Arguments

fit

the fitting object after fitting our model


psihat function

Description

This gives the psihat part in the sigmatwo estiamte

Usage

psihat(fit)

Arguments

fit

the fitting object after fitting our model

Value

psi_hat in the paper


qhatt function

Description

This gives the qhatt part in the sigmathree estiamte

Usage

qhatt(fit)

Arguments

fit

the fitting object after fitting our model

Value

q_hatt part in sigma_three, only appears in competing risks setting, in the paper


qprimehatt function

Description

This prepares for the variance estiamte of baseline hazards function

Usage

qprimehatt(fit, i)

Arguments

fit

the fitting object after fitting our model

i

the i-th round

Value

update the fit, add qprime_hatt


qprimepihatt function

Description

This prepares for the variance estiamte of baseline hazards function

Usage

qprimepihatt(fit)

Arguments

fit

the fitting object after fitting our model

Value

the integration of squares of q_t(u) over pi(u) in the paper, introduced by competing risks


regadditivefit function

Description

fit an additive hazard without using IV method

Usage

regadditivefit(survtime, cause, comp = FALSE, treatment = 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.

comp

the indicator of whether modeling subdistribution hazard

treatment

the treatment variable, can be null

covariates

all the observed confounders

Value

the fitting result, a list containing the cofficients, the baseline function, the variance covariance function of the coefficients and the byproduct including some pieces during the computing process


regcompadditivefit function

Description

fit an additive hazard without using IV method under competing risks settings

Usage

regcompadditivefit(survtime, cause, Z = 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.

Z

a variable contains all the regressors

Value

the fitting result, a list containing the cofficients, the baseline function and


regsuradditivefit function

Description

fit an additive hazard without using IV method under survival settings

Usage

regsurvadditivefit(survtime, cause, Z = 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.

Z

a variable contains all the regressors

Value

the fitting result, a list containing the cofficients, the baseline function and the byproduct including some pieces during the computing process


A scoreprocess function

Description

This gives us the scoreprocess function defined in the paper

Usage

scoreprocess(Z, Z_bar, cause)

Arguments

Z

a variable contains all the regressors

Z_bar

defined in the paper

cause

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

Value

the score_process


sigmaone function

Description

This gives the sigmaone part in the variance estiamte

Usage

sigmaone(fit)

Arguments

fit

the fitting object after fitting our model

Value

the sigma_one in the paper


sigmathree function

Description

This gives the sigmathree part in the variance estiamte

Usage

sigmathree(fit)

Arguments

fit

the fitting object after fitting our model

Value

the sigma_three in the paper


sigmatwo function

Description

This gives the sigmatwo part in the variance estiamte

Usage

sigmatwo(fit)

Arguments

fit

the fitting object after fitting our model

Value

the sigma_two in the paper


sone function

Description

The s_one function defined in the paper

Usage

sone(survtime, cause = NULL, Z, comp = FALSE, censorsurv = 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.

Z

a variable contains all the regressors

comp

the indicator of whether modeling subdistribution hazard

censorsurv

the estimate for the censoring distribution

Value

s_one defined in the paper


the summary function associated with our class

Description

This function will print our coefficients, the variance covariance matrix of the coeffieients, and the corresponding P-values

Usage

## S3 method for class 'tsriadditive'
summary(fit)

Arguments

fit

the fitting object after fitting our model


A survival prediction function

Description

The predict function associated with our class

Usage

survivalpred(fit, newtreatment = NULL, newIV = NULL,
  newcovariates = NULL)

Arguments

fit

the fitting object after fitting our model

newtreatment

the new treatment value

newIV

new instrumental variable value

newcovariates

new observed covariates

Value

an object recording the corresponding predicted survival curve and corresponding pointwise confidence interval


the pointwise confidence interval for the survival curve

Description

the pointwise confidence interval for the survival curve

Usage

survprobconfint(hazard_pred, newobsz, fit = NULL, alpha)

Arguments

hazard_pred

the predicted hazard function

newobsz

the new obtained Z value

fit

the fitting object after fitting our model

alpha

the prespecified level

Value

a list containing (1 - alpha) level pointwise confidence interval for the hazard function


szero function

Description

The s_zero function defined in the paper

Usage

szero(survtime, cause = NULL, comp = FALSE, censorsurv = 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.

comp

the indicator of whether modeling subdistribution hazard

censorsurv

the estimate for the censoring distribution

Value

s_zero defined in the paper


szeroint function

Description

This prepares for the variance estiamte of baseline hazards function

Usage

szeroint(fit)

Arguments

fit

the fitting object after fitting our model

Value

szero_int part in the paper


tsriadditive generic

Description

tsriadditive generic

Usage

tsriadditive(...)

Arguments

...

the other arguments


fit an additive hazards model with two stage residual inclusion method

Description

fit an additive hazards model with two stage residual inclusion method

Usage

## Default S3 method:
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

the fitting result, a class called "tsriadditive"


fit an additive hazard using two stage residual inclusion method

Description

fit an additive hazard using two stage residual inclusion method

Usage

tsriadditivefit(survtime, cause, comp = FALSE, 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.

comp

the indicator of whether modeling subdistribution hazard

treatment

the treatment variable, can be null

IV

the instrumental variable

covariates

all the observed confounders

Value

the fitting result, a list containing the cofficients, the baseline function, the variance covariance


fit an additive hazard without using IV method under competing risks settings

Description

fit an additive hazard without using IV method under competing risks settings

Usage

tsricompadditivefit(survtime, cause = NULL, Z)

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.

Z

a variable contains all the regressors

Value

the fitting result, a list containing the cofficients, the baseline function and the byproduct including some pieces during the computing process


fit an additive hazard using IV method under survival settings

Description

fit an additive hazard using IV method under survival settings

Usage

tsrisurvadditivefit(survtime, cause = NULL, Z)

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.

Z

a variable contains all the regressors

Value

the fitting result, a list containing the cofficients, the baseline function and the byproduct including some pieces during the computing process


the pointwise upper confidence interval for the survival curve

Description

the pointwise upper confidence interval for the survival curve

Usage

upperconfint(hazard_pred, hazardpredvar_est, newobsz, alpha)

Arguments

hazard_pred

the predicted hazard function

hazardpredvar_est

the variance of the estimator of the hazard function

newobsz

the new obtained Z value

alpha

the prespecified level

Value

the upper (1 - alpha) level pointwise confidence interval for the hazard function


YGint function

Description

This prepares for the variance estiamte of baseline hazards function

Usage

YGint(fit)

Arguments

fit

the fitting object after fitting our model

Value

YG_int part in the paper


Yint function

Description

This prepares for the variance estiamte of baseline hazards function

Usage

Yint(fit)

Arguments

fit

the fitting object after fitting our model

Value

Y_int part in the paper


Zbar function

Description

A function for computing Z_bar in the paper

Usage

Zbar(s_zero, s_one)

Arguments

s_zero

s_zero function

s_one

s_one function

Value

the Z_bar value in the paper, no difference for two settings


Zint function

Description

A function for computing the integration for Z_bar from zero to some time t

Usage

Zint(survtime, Z_bar)

Arguments

survtime

the event time

Z_bar

the Z_bar value

Value

the integration of Z_bar from zero to all the event time t