Title: | Censored Quantile Regression & Monotonicity-Respecting Restoring |
---|---|
Description: | Perform censored quantile regression of Huang (2010) <doi:10.1214/09-AOS771>, and restore monotonicity respecting via adaptive interpolation for dynamic regression of Huang (2017) <doi:10.1080/01621459.2016.1149070>. The monotonicity-respecting restoration applies to general dynamic regression models including (uncensored or censored) quantile regression model, additive hazards model, and dynamic survival models of Peng and Huang (2007) <doi:10.1093/biomet/asm058>, among others. |
Authors: | Yijian Huang <[email protected]> |
Maintainer: | Yijian Huang <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.5 |
Built: | 2024-12-09 06:49:54 UTC |
Source: | CRAN |
Implementation of censored quantile regression of Huang (2010), with incorporation of an upper bound related to the identification limit on probability scale as described in Huang (2013).
cequre(x,dlt,z,epsi=0.05,taus=numeric(0),res=0, resam.dist=FALSE,nbps=3*length(x))
cequre(x,dlt,z,epsi=0.05,taus=numeric(0),res=0, resam.dist=FALSE,nbps=3*length(x))
x |
follow-up time. |
dlt |
censoring indicator: 1 - event, 0 - censored. |
z |
matrix of covariates (intercept not included): each column corresponds to a covariate. |
epsi |
parameter for the upper bound related to the identification limit on probability scale. |
taus |
(increasing) tau values at which quantile coefficient is of interest. |
res |
number of resampling iterations for variance estimation: res=200 is typically sufficient for variance estimation, but res needs to be much larger for confidence band construction. |
resam.dist |
resampling distribution to be reported or not. |
nbps |
maximum storage size for quantile coefficient: 3*length(x is typically sufficient. |
curve |
estimated (piecewise-constant) quantile coefficient: each column corresponds to a jump point (the intercept is followed by slope coefficients, and final element is tau, the probability index.) |
tau.bnd |
upper bound of tau such that determinant of the at-risk matrix (for uncensored observations) is at least epsi^# regression coefficients times the initial value, subject to provided storage limit (nbps). |
bt |
estimated quantile coefficient at taus, only available if taus is specified. |
va |
variance estimate associated with bt, only available if taus is specified and res>0. As is resampling based, the variance estimate can be slightly different over multiple runs unless seed for the random number generator is reset each time. |
dist |
resampling distribution with res resampled curves: dist[ , ,1] through dist[ , ,res], only available if res>0 and resam.dist=TRUE. |
dist.lgth |
lengths of resampled curves, only available if res>0 and resam.dist=TRUE. |
Huang, Y. (2010) Quantile calculus and censored regression, The Annals of Statistics 38, 1607–1637.
Huang, Y. (2013) Fast censored linear regression. Scandinavian Journal of Statistics 40, 789–806.
## simulate a dataset following Scenario 1 of Table 1 in Huang (2010) num <- 200 beta <- c(.5, .5) cvt.1 <- as.numeric(runif(num)<0.5) cvt.2 <- runif(num) resid <- rexp(num) tres <- 1-exp(-resid) event.t <- log(resid)+beta[1]*cvt.1*ifelse(tres<.4,tres/.4,1)+beta[2]*cvt.2 censr.t <- log(runif(num, 0, 5)) x <- pmin(event.t, censr.t) dlt <- as.numeric(event.t<=censr.t) ## run censored quantile regression fit <- cequre(x,dlt,cbind(cvt.1,cvt.2),taus=.1*seq(1,7,2),res=200)
## simulate a dataset following Scenario 1 of Table 1 in Huang (2010) num <- 200 beta <- c(.5, .5) cvt.1 <- as.numeric(runif(num)<0.5) cvt.2 <- runif(num) resid <- rexp(num) tres <- 1-exp(-resid) event.t <- log(resid)+beta[1]*cvt.1*ifelse(tres<.4,tres/.4,1)+beta[2]*cvt.2 censr.t <- log(runif(num, 0, 5)) x <- pmin(event.t, censr.t) dlt <- as.numeric(event.t<=censr.t) ## run censored quantile regression fit <- cequre(x,dlt,cbind(cvt.1,cvt.2),taus=.1*seq(1,7,2),res=200)
Restoration of monotonicity respecting for dynamic regression models such as quantile regression model, Aalen's additive hazards model, and dynamic survival models of Peng and Huang (2007, Biometrika, pp 719–733).
monodr(origrc,zch,initau=0.5,taus=numeric(0))
monodr(origrc,zch,initau=0.5,taus=numeric(0))
origrc |
(piecewise-constant) original regression coefficient. |
zch |
collection of covariate values for which the monotonicity is enforced. In the presence of intercept in "origrc", unity element needs to be included. "zch" could be the original covariate matrix. However, using its convext hull, if readily available, may be computationally more efficient. |
initau |
starting tau value from which monotonicity-respecting is restored. |
taus |
(increasing) tau values at which quantile coefficient is of interest. |
airc |
regression coefficient after adaptive interpolation: each column corresponds to an interpolating point (the intercept is followed by slope coefficients, and final element is tau, the probability index.) |
bt |
adaptively interpolated coefficient at taus, only available if taus is specified. |
Huang, Y. (2017) Restoration of monotonicity respecting in dynamic regression. Journal of the American Statistical Association 112, 613–622.
## run the example in cequre first num <- 200 beta <- c(.5, .5) cvt.1 <- as.numeric(runif(num)<0.5) cvt.2 <- runif(num) resid <- rexp(num) tres <- 1-exp(-resid) event.t <- log(resid)+beta[1]*cvt.1*ifelse(tres<.4,tres/.4,1)+beta[2]*cvt.2 censr.t <- log(runif(num, 0, 5)) x <- pmin(event.t, censr.t) dlt <- as.numeric(event.t<=censr.t) fit <- cequre(x,dlt,cbind(cvt.1,cvt.2),taus=.1*seq(1,7,2),res=200) ## resotration of monotonicity respecting zch <- matrix(c(1,1,1,1,0,0,1,1,0,1,0,1),ncol=3) mfit <- monodr(fit$curve,zch,initau=fit$tau.bnd/2,taus=.1*seq(1,7,2))
## run the example in cequre first num <- 200 beta <- c(.5, .5) cvt.1 <- as.numeric(runif(num)<0.5) cvt.2 <- runif(num) resid <- rexp(num) tres <- 1-exp(-resid) event.t <- log(resid)+beta[1]*cvt.1*ifelse(tres<.4,tres/.4,1)+beta[2]*cvt.2 censr.t <- log(runif(num, 0, 5)) x <- pmin(event.t, censr.t) dlt <- as.numeric(event.t<=censr.t) fit <- cequre(x,dlt,cbind(cvt.1,cvt.2),taus=.1*seq(1,7,2),res=200) ## resotration of monotonicity respecting zch <- matrix(c(1,1,1,1,0,0,1,1,0,1,0,1),ncol=3) mfit <- monodr(fit$curve,zch,initau=fit$tau.bnd/2,taus=.1*seq(1,7,2))