Description Usage Arguments Details Value Note References See Also Examples
MCMC code for the quantile regression model of Reich and Smith, 2013.
1 2 3 4 5 |
X |
Matrix of predictors with the first column consisting of all ones and all other values between -1 and 1. |
Y |
A vector of responses. |
Y_low,Y_high |
Vectors of endpoints for interval-censored values. |
status |
Censoring status taking values |
L |
The number of basis functions in quantile function |
base |
The centering distribution which can take values "Gaussian", "t", "logistic", "gamma", "weibull", or "ALAP." |
varying_effect |
If varying_effect = j, then only the covariates in the first j columns of X have different effects on different quantile levels. |
tau |
Vector of quantile levels for output. |
burn |
Number of MCMC samples to discard as burn-in. |
iters |
Number of MCMC samples to generate after the burn-in. |
See http://www4.stat.ncsu.edu/~reich/QR/ for more detailed descriptions and examples.
q |
Posterior samples of the quantile function. |
LPML |
Log pseudo-maximum likelihood statistic for model comparisons. |
The example is used to illustrate the method. In practice MCMC chains should be longer.
Reich BJ, Smith LB (2013). Bayesian quantile regression for censored data. In press, Biometrics.
Smith LB, Fuentes M, Herring AH, Reich BJ (2013) Bayesian dependent quantile regression processes for birth outcomes. Submitted.
Reich BJ (2012) Spatiotemporal quantile regression for detecting distributional changes in environmental processes. JRSS-C, 64, 535-553.
Reich BJ, Fuentes M, Dunson DB (2011) Bayesian spatial quantile regression. JASA, 106, 620.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #Continuous data example
#Load the air quality data
data(airquality)
ozone<-airquality[,1]
solar<-airquality[,2]
#Remove missing observations
missing<-is.na(ozone+solar)
ozone<-ozone[!missing]
solar<-solar[!missing]
solar_std<-1.8*(solar - min(solar))/(max(solar)-min(solar)) - 0.9
#Fit the model and plot results
X<-cbind(1,solar_std)
#use longer chains in practice
fit<-qreg(X,ozone,L=4,base="gamma", iters = 1000, burn = 1000)
qr_plot(fit,2, main = "Solar Effect")
#Right-censored data example
library(survival)
data(veteran)
trt<-ifelse(veteran[,1]==2,-1,1)
logtime<-log(veteran[,3])
event<-veteran[,4]
status<-ifelse(event==1,0,2)
X<-cbind(1,trt)
#use longer chains in practice
fit<-qreg(X,Y=logtime,status=status,iters =1000, burn = 1000)
qr_plot(fit,index=2,main="Treatment effect")
|
Loading required package: quadprog
Loading required package: quantreg
Loading required package: SparseM
Attaching package: 'SparseM'
The following object is masked from 'package:base':
backsolve
Loading required package: VGAM
Loading required package: stats4
Loading required package: splines
Attaching package: 'survival'
The following object is masked from 'package:quantreg':
untangle.specials
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.