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 |
This gives the estimate of baseline hazards function
baselineest(cause, s_zero, Z_int, coef_est)
baselineest(cause, s_zero, Z_int, coef_est)
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 |
the baseline hazard function estimate
the confidence interval for our beta estimator
betaconfint(coef_est, vcov, alpha)
betaconfint(coef_est, vcov, alpha)
coef_est |
the estimate for beta |
vcov |
the variance covariance matrix for beta estimate |
alpha |
the prespecified level |
a list containing the (1 - alpha) level confidence interval
This gives the variance estiamte for heta
betavarest(fit)
betavarest(fit)
fit |
the fitting object after fitting our model |
the variance matrix of finite dimensional parameter part
This function returns us the estimate the finite dimensional part
coefest(N, omega_inv, score_process)
coefest(N, omega_inv, score_process)
N |
the sample size |
omega_inv |
the inverse of omega matrix in the paper |
score_process |
the score process in the paper |
the coefficent estimate from the fit
This prepares for the variance estiamte of baseline hazards function
Dhatt(fit)
Dhatt(fit)
fit |
the fitting object after fitting our model |
D_hat part in the paper
This prepares for the variance estiamte of baseline hazards function
Ehatt(fit, i)
Ehatt(fit, i)
fit |
the fitting object after fitting our model |
i |
the ith round of our data |
an integrated function with speed O(n) by recording each time result
This prepares for the variance estiamte of baseline hazards function
EThetaEpart(fit)
EThetaEpart(fit)
fit |
the fitting object after fitting our model |
E_Theta_E part in the paper
This prepares for the variance estiamte of baseline hazards function
Ghatt(fit, newobsz)
Ghatt(fit, newobsz)
fit |
the fitting object after fitting our model |
newobsz |
the new obtained Z value |
G_hat in the paper, the only part that changes with newobsz
This is the integration of our censorsurv from somewhere to infinity
Gint(survtime, censorsurv)
Gint(survtime, censorsurv)
survtime |
the event time |
censorsurv |
the estimate for the censoring distribution |
This is the integration of our censorsurv from somewhere to infinity
GZint(survtime, Z_bar, censorsurv)
GZint(survtime, Z_bar, censorsurv)
survtime |
the event time |
Z_bar |
defined in the paper |
censorsurv |
the estimate for the censoring distribution |
the predict function associated with our class
hazardpred(fit, newtreatment = NULL, newIV = NULL, newcovariates = NULL)
hazardpred(fit, newtreatment = NULL, newIV = NULL, newcovariates = NULL)
fit |
the fitting object after fitting our model |
newtreatment |
the new treatment value |
newIV |
new instrumental variable value |
newcovariates |
new observed covariates |
an object recording the corresponding predicted survival curve and corresponding pointwise confidence interval
This gives the variance estimate for our prediction of the hazard function
hazardpredvarest(newobsz, fit = NULL)
hazardpredvarest(newobsz, fit = NULL)
newobsz |
the new obtained Z value |
fit |
the fitting object after fitting our model |
the variance of hazard function at each time point
This prepares for the variance estiamte of baseline hazards function
leadpart(fit)
leadpart(fit)
fit |
the fitting object after fitting our model |
the leading part in our variance estimate
the pointwise lower confidence interval for the survival curve
lowerconfint(hazard_pred, hazardpredvar_est, newobsz, alpha)
lowerconfint(hazard_pred, hazardpredvar_est, newobsz, alpha)
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 |
the lower (1 - alpha) level pointwise confidence interval for the hazard function
This is for inverse of omega, which is part of the sandwich estimator
omegainv(N, survtime, Z, Z_int, cause, comp = FALSE, censorsurv = NULL, G_int = NULL, GZ_int = NULL)
omegainv(N, survtime, Z, Z_int, cause, comp = FALSE, censorsurv = NULL, G_int = NULL, GZ_int = NULL)
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 |
the Omega matrix appear in the paper
This gives the pihatt part in the sigmathree estiamte
pihatt(fit)
pihatt(fit)
fit |
the fitting object after fitting our model |
pi_hatt part in sigma_three, only appears in competing risks setting, in the paper
this function will plot the predicted curve and corresponding pointwise confidence interval at level alpha
## S3 method for class 'tsriadditive' plot(fit, newtreatment = NULL, newIV = NULL, newcovariates = NULL, alpha = 0.05, unit = "", ...)
## S3 method for class 'tsriadditive' plot(fit, newtreatment = NULL, newIV = NULL, newcovariates = NULL, alpha = 0.05, unit = "", ...)
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
## S3 method for class 'tsriadditive' predict(fit, newtreatment = NULL, newIV = NULL, newcovariates = NULL)
## S3 method for class 'tsriadditive' predict(fit, newtreatment = NULL, newIV = NULL, newcovariates = NULL)
fit |
the fitting object after fitting our model |
newtreatment |
the new treatment value |
newIV |
new instrumental variable value |
newcovariates |
new observed covariates |
an object recording the corresponding predicted survival curve and corresponding pointwise confidence interval
This function will print our coefficients, the variance covariance matrix of the coeffieients, and the estimate for the baseline hazard function
## S3 method for class 'tsriadditive' print(fit)
## S3 method for class 'tsriadditive' print(fit)
fit |
the fitting object after fitting our model |
This gives the psihat part in the sigmatwo estiamte
psihat(fit)
psihat(fit)
fit |
the fitting object after fitting our model |
psi_hat in the paper
This gives the qhatt part in the sigmathree estiamte
qhatt(fit)
qhatt(fit)
fit |
the fitting object after fitting our model |
q_hatt part in sigma_three, only appears in competing risks setting, in the paper
This prepares for the variance estiamte of baseline hazards function
qprimehatt(fit, i)
qprimehatt(fit, i)
fit |
the fitting object after fitting our model |
i |
the i-th round |
update the fit, add qprime_hatt
This prepares for the variance estiamte of baseline hazards function
qprimepihatt(fit)
qprimepihatt(fit)
fit |
the fitting object after fitting our model |
the integration of squares of q_t(u) over pi(u) in the paper, introduced by competing risks
fit an additive hazard without using IV method
regadditivefit(survtime, cause, comp = FALSE, treatment = NULL, covariates = NULL)
regadditivefit(survtime, cause, comp = FALSE, treatment = NULL, covariates = NULL)
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 |
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
fit an additive hazard without using IV method under competing risks settings
regcompadditivefit(survtime, cause, Z = NULL)
regcompadditivefit(survtime, cause, Z = NULL)
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 |
the fitting result, a list containing the cofficients, the baseline function and
fit an additive hazard without using IV method under survival settings
regsurvadditivefit(survtime, cause, Z = NULL)
regsurvadditivefit(survtime, cause, Z = NULL)
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 |
the fitting result, a list containing the cofficients, the baseline function and the byproduct including some pieces during the computing process
This gives us the scoreprocess function defined in the paper
scoreprocess(Z, Z_bar, cause)
scoreprocess(Z, Z_bar, cause)
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. |
the score_process
This gives the sigmaone part in the variance estiamte
sigmaone(fit)
sigmaone(fit)
fit |
the fitting object after fitting our model |
the sigma_one in the paper
This gives the sigmathree part in the variance estiamte
sigmathree(fit)
sigmathree(fit)
fit |
the fitting object after fitting our model |
the sigma_three in the paper
This gives the sigmatwo part in the variance estiamte
sigmatwo(fit)
sigmatwo(fit)
fit |
the fitting object after fitting our model |
the sigma_two in the paper
The s_one function defined in the paper
sone(survtime, cause = NULL, Z, comp = FALSE, censorsurv = NULL)
sone(survtime, cause = NULL, Z, comp = FALSE, censorsurv = NULL)
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 |
s_one defined in the paper
This function will print our coefficients, the variance covariance matrix of the coeffieients, and the corresponding P-values
## S3 method for class 'tsriadditive' summary(fit)
## S3 method for class 'tsriadditive' summary(fit)
fit |
the fitting object after fitting our model |
The predict function associated with our class
survivalpred(fit, newtreatment = NULL, newIV = NULL, newcovariates = NULL)
survivalpred(fit, newtreatment = NULL, newIV = NULL, newcovariates = NULL)
fit |
the fitting object after fitting our model |
newtreatment |
the new treatment value |
newIV |
new instrumental variable value |
newcovariates |
new observed covariates |
an object recording the corresponding predicted survival curve and corresponding pointwise confidence interval
the pointwise confidence interval for the survival curve
survprobconfint(hazard_pred, newobsz, fit = NULL, alpha)
survprobconfint(hazard_pred, newobsz, fit = NULL, alpha)
hazard_pred |
the predicted hazard function |
newobsz |
the new obtained Z value |
fit |
the fitting object after fitting our model |
alpha |
the prespecified level |
a list containing (1 - alpha) level pointwise confidence interval for the hazard function
The s_zero function defined in the paper
szero(survtime, cause = NULL, comp = FALSE, censorsurv = NULL)
szero(survtime, cause = NULL, comp = FALSE, censorsurv = NULL)
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 |
s_zero defined in the paper
This prepares for the variance estiamte of baseline hazards function
szeroint(fit)
szeroint(fit)
fit |
the fitting object after fitting our model |
szero_int part in the paper
tsriadditive generic
tsriadditive(...)
tsriadditive(...)
... |
the other arguments |
fit an additive hazards model with two stage residual inclusion method
## Default S3 method: tsriadditive(survtime, cause = NULL, treatment = NULL, IV = NULL, covariates = NULL)
## Default S3 method: tsriadditive(survtime, cause = NULL, treatment = NULL, IV = NULL, covariates = NULL)
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 |
the fitting result, a class called "tsriadditive"
fit an additive hazard using two stage residual inclusion method
tsriadditivefit(survtime, cause, comp = FALSE, treatment = NULL, IV = NULL, covariates = NULL)
tsriadditivefit(survtime, cause, comp = FALSE, treatment = NULL, IV = NULL, covariates = NULL)
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 |
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
tsricompadditivefit(survtime, cause = NULL, Z)
tsricompadditivefit(survtime, cause = NULL, Z)
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 |
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
tsrisurvadditivefit(survtime, cause = NULL, Z)
tsrisurvadditivefit(survtime, cause = NULL, Z)
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 |
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
upperconfint(hazard_pred, hazardpredvar_est, newobsz, alpha)
upperconfint(hazard_pred, hazardpredvar_est, newobsz, alpha)
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 |
the upper (1 - alpha) level pointwise confidence interval for the hazard function
This prepares for the variance estiamte of baseline hazards function
YGint(fit)
YGint(fit)
fit |
the fitting object after fitting our model |
YG_int part in the paper
This prepares for the variance estiamte of baseline hazards function
Yint(fit)
Yint(fit)
fit |
the fitting object after fitting our model |
Y_int part in the paper
A function for computing Z_bar in the paper
Zbar(s_zero, s_one)
Zbar(s_zero, s_one)
s_zero |
s_zero function |
s_one |
s_one function |
the Z_bar value in the paper, no difference for two settings
A function for computing the integration for Z_bar from zero to some time t
Zint(survtime, Z_bar)
Zint(survtime, Z_bar)
survtime |
the event time |
Z_bar |
the Z_bar value |
the integration of Z_bar from zero to all the event time t