Title: | Optimal Treatment Regimes in Survival Contexts with Kaplan-Meier-Like Estimators |
---|---|
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) <arXiv:2210.05538>). |
Authors: | Junwen Xia [aut, cre], Zishu Zhan [aut], Jingxiao Zhang [aut] |
Maintainer: | Junwen Xia <[email protected]> |
License: | MIT + file LICENSE |
Version: | 0.2.1 |
Built: | 2025-03-01 03:34:40 UTC |
Source: | https://github.com/cran/otrKM |
Given a predetermined t0 and eta, calculate t0-year potential survival probability based on the (S)AIWKME estimator.
AIWKME(eta, datalist, ps, prep, t0, smooth = TRUE)
AIWKME(eta, datalist, ps, prep, t0, smooth = TRUE)
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. |
More details can be found in references.
Estimated potential survival probability given eta and t0.
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
# 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)
# 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)
Limit the number not to be too large or too small.
clipp(x)
clipp(x)
x |
A vector or matrix. |
A vector or matrix same as the input.
Given a predetermined t0 and eta, calculate t0-year potential survival probability based on the (S)DRKMEIV estimator.
DRKMEIV(eta, datalist, ps, prep, t0, smooth = TRUE)
DRKMEIV(eta, datalist, ps, prep, t0, smooth = TRUE)
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. |
More details can be found in references.
Estimated potential survival probability given eta and t0.
Xia, J., Zhan, Z., Zhang, J. (2022) Estimating optimal treatment regime in survival contexts using an instrumental variable. Under Review.
# 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)
# 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.
Fprep.AIWKME(datalist, t0)
Fprep.AIWKME(datalist, t0)
datalist |
A list used to calculate the (S)AIWKME estimator including treatment named |
t0 |
A predetermined t. |
More details can be found in references, AIWKME
, and Genetic.optim.AIWKME
.
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.
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.
Fprep.DRKMEIV(datalist, ps, t0)
Fprep.DRKMEIV(datalist, ps, t0)
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. |
More details can be found in references, DRKMEIV
, and Genetic.optim.DRKMEIV
.
A list including estimates with treatment all to 1 named
gamma.num.1
and all to 0 named gamma.num.0
, with treatment all to 1 named
gammaa.num.1
and all to 0 named gammaa.num.0
, with treatment all to 1 named
gamma.den.1
and all to 0 named gamma.den.0
, and 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.
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.
Fps.AIWKME(datalist)
Fps.AIWKME(datalist)
datalist |
A list used to calculate the (S)AIWKME estimator including treatment named |
More details can be found in references, AIWKME
, and Genetic.optim.AIWKME
.
A list including the probability of receiving treatment given baseline covariates named fal
.
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.
Fps.DRKMEIV(datalist, t0)
Fps.DRKMEIV(datalist, t0)
datalist |
A list used to calculate the (S)DRKMEIV estimator including treatment named |
t0 |
A predetermined t. |
More details can be found in references, DRKMEIV
, and Genetic.optim.DRKMEIV
.
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
.
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.
Fps.IWKME(datalist)
Fps.IWKME(datalist)
datalist |
A list used to calculate the (S)IWKME estimator including treatment named |
More details can be found in references, IWKME
, and Genetic.optim.IWKME
.
A list including the probability of receiving treatment given baseline covariates named fal
.
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.
Fps.IWKMEIV(datalist, t0)
Fps.IWKMEIV(datalist, t0)
datalist |
A list used to calculate the (S)IWKMEIV estimator including treatment named |
t0 |
A predetermined t. |
More details can be found in references, IWKMEIV
, and Genetic.optim.IWKMEIV
.
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
.
Xia, J., Zhan, Z., Zhang, J. (2022) Estimating optimal treatment regime in survival contexts using an instrumental variable. Under Review.
Given a predetermined t0, estimate the optimal treatment regime by maximizing t0-year survival probability based on the (S)AIWKME estimator.
Genetic.optim.AIWKME(datalist, ps, prep, t0, smooth = TRUE)
Genetic.optim.AIWKME(datalist, ps, prep, t0, smooth = TRUE)
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. |
More details can be found in references.
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.
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
# 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)
# 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)
Given a predetermined t0, estimate the optimal treatment regime by maximizing t0-year survival probability based on the (S)DRKMEIV estimator.
Genetic.optim.DRKMEIV(datalist, ps, prep, t0, smooth = TRUE)
Genetic.optim.DRKMEIV(datalist, ps, prep, t0, smooth = TRUE)
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. |
More details can be found in references.
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.
Xia, J., Zhan, Z., Zhang, J. (2022) Estimating optimal treatment regime in survival contexts using an instrumental variable. Under Review.
# 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)
# 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)
Given a predetermined t0, estimate the optimal treatment regime by maximizing t0-year survival probability based on the (S)IWKME estimator.
Genetic.optim.IWKME(datalist, ps, t0, smooth = TRUE)
Genetic.optim.IWKME(datalist, ps, t0, smooth = TRUE)
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. |
More details can be found in references.
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.
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
# 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)
# 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)
Given a predetermined t0, estimate the optimal treatment regime by maximizing t0-year survival probability based on the (S)IWKMEIV estimator.
Genetic.optim.IWKMEIV(datalist, ps, t0, smooth = TRUE)
Genetic.optim.IWKMEIV(datalist, ps, t0, smooth = TRUE)
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. |
More details can be found in references.
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.
Xia, J., Zhan, Z., Zhang, J. (2022) Estimating optimal treatment regime in survival contexts using an instrumental variable. Under Review.
# 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)
# 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)
Given a predetermined t0 and eta, calculate t0-year potential survival probability based on the (S)IWKME estimator.
IWKME(eta, datalist, ps, t0, smooth = TRUE)
IWKME(eta, datalist, ps, t0, smooth = TRUE)
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. |
More details can be found in references.
Estimated potential survival probability given eta and t0.
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
# 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)
# 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)
Given a predetermined t0 and eta, calculate t0-year potential survival probability based on the (S)IWKMEIV estimator.
IWKMEIV(eta, datalist, ps, t0, smooth = TRUE)
IWKMEIV(eta, datalist, ps, t0, smooth = TRUE)
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. |
More details can be found in references.
Estimated potential survival probability given eta and t0.
Xia, J., Zhan, Z., Zhang, J. (2022) Estimating optimal treatment regime in survival contexts using an instrumental variable. Under Review.
# 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)
# 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)
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.
simulation
simulation
An object of class data.frame
with 500 rows and 6 columns.
head(simulation)
head(simulation)