Type: | Package |
Title: | Optimal Treatment Regimes in Survival Contexts with Kaplan-Meier-Like Estimators |
Version: | 0.2.1 |
Description: | Provide methods for estimating optimal treatment regimes in survival contexts with Kaplan-Meier-like estimators when no unmeasured confounding assumption is satisfied (Jiang, R., Lu, W., Song, R., and Davidian, M. (2017) <doi:10.1111/rssb.12201>) and when no unmeasured confounding assumption fails to hold and a binary instrument is available (Xia, J., Zhan, Z., Zhang, J. (2022) <doi:10.48550/arXiv.2210.05538>). |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
LazyData: | true |
Imports: | rgenoud, survival |
Depends: | R (≥ 3.10) |
RoxygenNote: | 7.2.2 |
NeedsCompilation: | no |
Packaged: | 2023-07-04 13:35:10 UTC; xiajunwen |
Author: | Junwen Xia [aut, cre], Zishu Zhan [aut], Jingxiao Zhang [aut] |
Maintainer: | Junwen Xia <xiajunwen@ruc.edu.cn> |
Repository: | CRAN |
Date/Publication: | 2023-07-06 15:10:02 UTC |
The (S)AIWKME estimator.
Description
Given a predetermined t0 and eta, calculate t0-year potential survival probability based on the (S)AIWKME estimator.
Usage
AIWKME(eta, datalist, ps, prep, t0, smooth = TRUE)
Arguments
eta |
The parameters of the regime. |
datalist |
A list used to calculate the (S)AIWKME estimator including treatment named |
ps |
A list including the probability of receiving treatment given baseline covariates named |
prep |
A list including the augmented terms in the numerator with treatment all to 1 named |
t0 |
A predetermined time. |
smooth |
A logic variable indicating wether a smoothed estimator should be used. |
Details
More details can be found in references.
Value
Estimated potential survival probability given eta and t0.
References
Jiang, R., Lu, W., Song, R., and Davidian, M. (2017) On estimation of optimal treatment regimes for maximizing t‐year survival probability. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 79: 1165-1185. DOI:10.1111/rssb.12201
Examples
# load data
data(simulation)
simulation=simulation[order(simulation$Survival),]
# convert the data into a datalist
datalist=list(z=simulation$Instrument,a=simulation$Treatment,
obs.t=simulation$Survival,delta=simulation$Status,
l=cbind(simulation$Covariate1,simulation$Covariate2))
# predetermined t0 and eta
t0=5
eta=c(1,2,3)
# calculate ps and prep
ps=Fps.AIWKME(datalist)
prep=Fprep.AIWKME(datalist, t0)
AIWKME(eta, datalist, ps, prep, t0, smooth=TRUE)
The (S)DRKMEIV estimator.
Description
Given a predetermined t0 and eta, calculate t0-year potential survival probability based on the (S)DRKMEIV estimator.
Usage
DRKMEIV(eta, datalist, ps, prep, t0, smooth = TRUE)
Arguments
eta |
The parameters of the regime. |
datalist |
A list used to calculate the (S)DRKMEIV estimator including treatment named |
ps |
A list including the probability of receiving instrument given baseline covariates named |
prep |
A list including estimates |
t0 |
A predetermined time. |
smooth |
A logic variable indicating wether a smoothed version should be used. |
Details
More details can be found in references.
Value
Estimated potential survival probability given eta and t0.
References
Xia, J., Zhan, Z., Zhang, J. (2022) Estimating optimal treatment regime in survival contexts using an instrumental variable. Under Review.
Examples
# load data
data(simulation)
simulation=simulation[order(simulation$Survival),]
# convert the data into a datalist
datalist=list(z=simulation$Instrument,a=simulation$Treatment,
obs.t=simulation$Survival,delta=simulation$Status,
l=cbind(simulation$Covariate1,simulation$Covariate2))
# predetermined t0 and eta
t0=5
eta=c(1,2,3)
# calculate ps and prep
ps=Fps.DRKMEIV(datalist,t0)
prep=Fprep.DRKMEIV(datalist, ps, t0)
DRKMEIV(eta, datalist, ps, prep, t0, smooth=TRUE)
Cox proportional hazards model for eta-free terms in the (S)AIWKME estimator.
Description
Cox proportional hazards model for eta-free terms in the (S)AIWKME estimator.
Usage
Fprep.AIWKME(datalist, t0)
Arguments
datalist |
A list used to calculate the (S)AIWKME estimator including treatment named |
t0 |
A predetermined t. |
Details
More details can be found in references, AIWKME
, and Genetic.optim.AIWKME
.
Value
A list including the augmented terms in the numerator with treatment all to 1 named gamma.num.1
and all to 0 named gamma.num.0
and in the denominator with treatment all to 1 named gamma.den.1
and all to 0 named gamma.den.0
; gamma.num.1
and the others are matrix with ordered observed time as rows and patients as columns. More details can be found in references.
References
Jiang, R., Lu, W., Song, R., and Davidian, M. (2017) On estimation of optimal treatment regimes for maximizing t‐year survival probability. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 79: 1165-1185. DOI:10.1111/rssb.12201
Cox proportional hazards model for eta-free terms in the (S)DRKMEIV estimator.
Description
Cox proportional hazards model for eta-free terms in the (S)DRKMEIV estimator.
Usage
Fprep.DRKMEIV(datalist, ps, t0)
Arguments
datalist |
A list used to calculate the (S)DRKMEIV estimator including treatment named |
ps |
A list including the probability of receiving instrument given baseline covariates named |
t0 |
A predetermined t. |
Details
More details can be found in references, DRKMEIV
, and Genetic.optim.DRKMEIV
.
Value
A list including estimates \hat{\gamma}_1(\boldsymbol{L};s)
with treatment all to 1 named gamma.num.1
and all to 0 named gamma.num.0
, \hat{\gamma}_1'(\boldsymbol{L};s)
with treatment all to 1 named gammaa.num.1
and all to 0 named gammaa.num.0
, \hat{\gamma}_2(\boldsymbol{L};s)
with treatment all to 1 named gamma.den.1
and all to 0 named gamma.den.0
, and \hat{\gamma}_2'(\boldsymbol{L};s)
with treatment all to 1 named gammaa.den.1
and all to 0 named gammaa.den.0
; gamma.num.1
and the others are matrix with ordered observed time as rows and patients as columns. There are also estimates for the last term of the (S)DRIWKMEIV estimator. More details can be found in references.
References
Xia, J., Zhan, Z., Zhang, J. (2022) Estimating optimal treatment regime in survival contexts using an instrumental variable. Under Review.
Logistic regression for observed treatment used for the (S)AIWKME estimator.
Description
Logistic regression for observed treatment used for the (S)AIWKME estimator.
Usage
Fps.AIWKME(datalist)
Arguments
datalist |
A list used to calculate the (S)AIWKME estimator including treatment named |
Details
More details can be found in references, AIWKME
, and Genetic.optim.AIWKME
.
Value
A list including the probability of receiving treatment given baseline covariates named fal
.
References
Jiang, R., Lu, W., Song, R., and Davidian, M. (2017) On estimation of optimal treatment regimes for maximizing t‐year survival probability. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 79: 1165-1185. DOI:10.1111/rssb.12201
Logistic regression for observed treatment and instrument used for the (S)DRKMEIV estimator.
Description
Logistic regression for observed treatment and instrument used for the (S)DRKMEIV estimator.
Usage
Fps.DRKMEIV(datalist, t0)
Arguments
datalist |
A list used to calculate the (S)DRKMEIV estimator including treatment named |
t0 |
A predetermined t. |
Details
More details can be found in references, DRKMEIV
, and Genetic.optim.DRKMEIV
.
Value
A list including the probability of receiving instrument given baseline covariates named fzl
, the probability of receiving treatment given baseline covariates and instrument equaling 0 named fal0
, the probability of receiving treatment given baseline covariates and instrument equaling 1 named fal1
, the difference between fal1
and fal0
named deltal
, and the censoring survival function given baseline covariates and treatment 1 or 0 named surv.C.1
or surv.C.0
.
References
Xia, J., Zhan, Z., Zhang, J. (2022) Estimating optimal treatment regime in survival contexts using an instrumental variable. Under Review.
Logistic regression for observed treatment used for the (S)IWKME estimator.
Description
Logistic regression for observed treatment used for the (S)IWKME estimator.
Usage
Fps.IWKME(datalist)
Arguments
datalist |
A list used to calculate the (S)IWKME estimator including treatment named |
Details
More details can be found in references, IWKME
, and Genetic.optim.IWKME
.
Value
A list including the probability of receiving treatment given baseline covariates named fal
.
References
Jiang, R., Lu, W., Song, R., and Davidian, M. (2017) On estimation of optimal treatment regimes for maximizing t‐year survival probability. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 79: 1165-1185. DOI:10.1111/rssb.12201
Logistic regression for observed treatment and instrument used for the (S)IWKMEIV estimator.
Description
Logistic regression for observed treatment and instrument used for the (S)IWKMEIV estimator.
Usage
Fps.IWKMEIV(datalist, t0)
Arguments
datalist |
A list used to calculate the (S)IWKMEIV estimator including treatment named |
t0 |
A predetermined t. |
Details
More details can be found in references, IWKMEIV
, and Genetic.optim.IWKMEIV
.
Value
A list including the probability of receiving instrument given baseline covariates named fzl
, the difference between fal1 and fal0 named deltal
, where fal0 denotes the probability of receiving treatment given baseline covariates and instrument equaling 0, and fal1 denotes the probability of receiving treatment given baseline covariates and instrument equaling 1, and the censoring survival function given baseline covariates and treatment 1 or 0 named surv.C.1
or surv.C.0
.
References
Xia, J., Zhan, Z., Zhang, J. (2022) Estimating optimal treatment regime in survival contexts using an instrumental variable. Under Review.
The optimal treatment regime based on the (S)AIWKME estimator.
Description
Given a predetermined t0, estimate the optimal treatment regime by maximizing t0-year survival probability based on the (S)AIWKME estimator.
Usage
Genetic.optim.AIWKME(datalist, ps, prep, t0, smooth = TRUE)
Arguments
datalist |
A list used to calculate the (S)AIWKME estimator including treatment named |
ps |
A list including the probability of receiving treatment given baseline covariates named |
prep |
A list including the augmented terms in the numerator with treatment all to 1 named |
t0 |
A predetermined time. |
smooth |
A logic variable indicating wether a smoothed version should be used. |
Details
More details can be found in references.
Value
A numeric vector in which the last number is the estimated optimal t0-year survival probability and others are the estimated parameters of the optimal treatment regime.
References
Jiang, R., Lu, W., Song, R., and Davidian, M. (2017) On estimation of optimal treatment regimes for maximizing t‐year survival probability. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 79: 1165-1185. DOI:10.1111/rssb.12201
Examples
# load data
data(simulation)
simulation=simulation[order(simulation$Survival),]
# convert the data into a datalist
datalist=list(z=simulation$Instrument,a=simulation$Treatment,
obs.t=simulation$Survival,delta=simulation$Status,
l=cbind(simulation$Covariate1,simulation$Covariate2))
# predetermined t0
t0=5
# calculate ps and prep
ps=Fps.AIWKME(datalist)
prep=Fprep.AIWKME(datalist, t0)
Genetic.optim.AIWKME(datalist, ps, prep, t0, smooth=TRUE)
The optimal treatment regime based on the (S)DRKMEIV estimator.
Description
Given a predetermined t0, estimate the optimal treatment regime by maximizing t0-year survival probability based on the (S)DRKMEIV estimator.
Usage
Genetic.optim.DRKMEIV(datalist, ps, prep, t0, smooth = TRUE)
Arguments
datalist |
A list used to calculate the (S)DRKMEIV estimator including instrument named |
ps |
A list including the probability of receiving instrument given baseline covariates named |
prep |
A list including estimates |
t0 |
A predetermined time to point out that t0-year survival probability is our estimate |
smooth |
A logic variable indicating wether a smoothed version should be used. |
Details
More details can be found in references.
Value
A numeric vector in which the last number is the estimated optimal t0-year survival probability and the others are the estimated parameter of the optimal treatment regime.
References
Xia, J., Zhan, Z., Zhang, J. (2022) Estimating optimal treatment regime in survival contexts using an instrumental variable. Under Review.
Examples
# load data
data(simulation)
# order the data by observed time and select the first 200 patients to speed up
simulation=simulation[order(simulation$Survival)[1:200],]
# convert the data into a datalist
datalist=list(z=simulation$Instrument,a=simulation$Treatment,
obs.t=simulation$Survival,delta=simulation$Status,
l=cbind(simulation$Covariate1,simulation$Covariate2))
# predetermined t0
t0=1
# calculate ps and prep
ps=Fps.DRKMEIV(datalist, t0)
prep=Fprep.DRKMEIV(datalist, ps, t0)
Genetic.optim.DRKMEIV(datalist, ps, prep, t0, smooth=TRUE)
The optimal treatment regime based on the (S)IWKME estimator.
Description
Given a predetermined t0, estimate the optimal treatment regime by maximizing t0-year survival probability based on the (S)IWKME estimator.
Usage
Genetic.optim.IWKME(datalist, ps, t0, smooth = TRUE)
Arguments
datalist |
A list used to calculate the (S)IWKME estimator including treatment named |
ps |
A list including the probability of receiving treatment given baseline covariates named |
t0 |
A predetermined time. |
smooth |
A logic variable indicating wether a smoothed version should be used. |
Details
More details can be found in references.
Value
A numeric vector in which the last number is the estimated optimal t0-year survival probability and the others are the estimated parameter of the optimal treatment regime.
References
Jiang, R., Lu, W., Song, R., and Davidian, M. (2017) On estimation of optimal treatment regimes for maximizing t‐year survival probability. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 79: 1165-1185. DOI:10.1111/rssb.12201
Examples
# load data
data(simulation)
simulation=simulation[order(simulation$Survival),]
# convert the data into a datalist
datalist=list(z=simulation$Instrument,a=simulation$Treatment,
obs.t=simulation$Survival,delta=simulation$Status,
l=cbind(simulation$Covariate1,simulation$Covariate2))
# predetermined t0
t0=5
# calculate ps
ps=Fps.IWKME(datalist)
Genetic.optim.IWKME(datalist, ps, t0, smooth=TRUE)
The optimal treatment regime based on the (S)IWKMEIV estimator.
Description
Given a predetermined t0, estimate the optimal treatment regime by maximizing t0-year survival probability based on the (S)IWKMEIV estimator.
Usage
Genetic.optim.IWKMEIV(datalist, ps, t0, smooth = TRUE)
Arguments
datalist |
A list used to calculate the (S)IWKMEIV estimator including instrument named z, treatment named |
ps |
A list including the probability of receiving instrument given baseline covariates named |
t0 |
A predetermined time. |
smooth |
A logic variable indicating wether a smoothed version should be used. |
Details
More details can be found in references.
Value
A numeric vector in which the last number is the estimated optimal t0-year survival probability and others are the estimated parameter of the optimal treatment regime.
References
Xia, J., Zhan, Z., Zhang, J. (2022) Estimating optimal treatment regime in survival contexts using an instrumental variable. Under Review.
Examples
# load data
data(simulation)
simulation=simulation[order(simulation$Survival),]
# convert the data into a datalist
datalist=list(z=simulation$Instrument,a=simulation$Treatment,
obs.t=simulation$Survival,delta=simulation$Status,
l=cbind(simulation$Covariate1,simulation$Covariate2))
# predetermined t0
t0=1
# calculate ps and prep
ps=Fps.IWKMEIV(datalist, t0)
Genetic.optim.IWKMEIV(datalist, ps, t0, smooth=TRUE)
The (S)IWKME estimator.
Description
Given a predetermined t0 and eta, calculate t0-year potential survival probability based on the (S)IWKME estimator.
Usage
IWKME(eta, datalist, ps, t0, smooth = TRUE)
Arguments
eta |
The parameters of the regime. |
datalist |
A list used to calculate the (S)IWKME estimator including treatment named |
ps |
A list including the probability of receiving treatment given baseline covariates named |
t0 |
A predetermined time. |
smooth |
A logic variable indicating wether a smoothed estimator should be used. |
Details
More details can be found in references.
Value
Estimated potential survival probability given eta and t0.
References
Jiang, R., Lu, W., Song, R., and Davidian, M. (2017) On estimation of optimal treatment regimes for maximizing t‐year survival probability. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 79: 1165-1185. DOI:10.1111/rssb.12201
Examples
# load data
data(simulation)
simulation=simulation[order(simulation$Survival),]
# convert the data into a datalist
datalist=list(z=simulation$Instrument,a=simulation$Treatment,
obs.t=simulation$Survival,delta=simulation$Status,
l=cbind(simulation$Covariate1,simulation$Covariate2))
# calculate ps
ps=Fps.IWKME(datalist)
# predetermined t0 and eta
t0=5
eta=c(1,2,3)
IWKME(eta, datalist, ps, t0, smooth=TRUE)
The (S)IWKMEIV estimator.
Description
Given a predetermined t0 and eta, calculate t0-year potential survival probability based on the (S)IWKMEIV estimator.
Usage
IWKMEIV(eta, datalist, ps, t0, smooth = TRUE)
Arguments
eta |
The parameters of the regime. |
datalist |
A list used to calculate the (S)IWKMEIV estimator including treatment named |
ps |
A list including the probability of receiving instrument given baseline covariates named |
t0 |
A predetermined time. |
smooth |
A logic variable indicating wether a smoothed version should be used. |
Details
More details can be found in references.
Value
Estimated potential survival probability given eta and t0.
References
Xia, J., Zhan, Z., Zhang, J. (2022) Estimating optimal treatment regime in survival contexts using an instrumental variable. Under Review.
Examples
# load data
data(simulation)
simulation=simulation[order(simulation$Survival),]
# convert the data into a datalist
datalist=list(z=simulation$Instrument,a=simulation$Treatment,
obs.t=simulation$Survival,delta=simulation$Status,
l=cbind(simulation$Covariate1,simulation$Covariate2))
# predetermined t0 and eta
t0=5
eta=c(1,2,3)
# calculate ps and prep
ps=Fps.IWKMEIV(datalist, t0)
IWKMEIV(eta, datalist, ps, t0, smooth=TRUE)
clip function.
Description
Limit the number not to be too large or too small.
Usage
clipp(x)
Arguments
x |
A vector or matrix. |
Value
A vector or matrix same as the input.
Simulation
Description
A simulation data to help understand and implement the functions in the package. 'Instrument' denotes the binary instrumental variable. 'Treatment' denotes the binary treatment. 'Survival' denotes the observed survival time. 'Status' denotes whether the the data is censoring where '0' means censoring. 'Covariate' denotes the baseline characteristics.
Usage
simulation
Format
An object of class data.frame
with 500 rows and 6 columns.
Examples
head(simulation)