Title: | Bayesian Estimation for Quantile Regression Mixed Models |
---|---|
Description: | Using a Bayesian estimation procedure, this package fits linear quantile regression models such as linear quantile models, linear quantile mixed models, quantile regression joint models for time-to-event and longitudinal data. The estimation procedure is based on the asymmetric Laplace distribution and the 'JAGS' software is used to get posterior samples (Yang, Luo, DeSantis (2019) <doi:10.1177/0962280218784757>). |
Authors: | Antoine Barbieri [aut, cre], Hélène Jacqmin-Gadda [aut] |
Maintainer: | Antoine Barbieri <[email protected]> |
License: | GPL (>= 2.0) |
Version: | 0.1.0 |
Built: | 2024-11-03 06:23:27 UTC |
Source: | CRAN |
'dataLong' is a dataset simulated from a joint model for longitudinal and time-to-event data. This dataset is used to illustrate both 'lqmm' and 'qrjm' functions.
data(dataLong)
data(dataLong)
A data.frame
with 1562 observations from 300 subjects. The columns are:
integer: number for patient identification.
numeric: measurement times for the repeated blood pressure measurements.
numeric: longitudinal measurements.
numeric: time to event (or censoring).
integer: event indicator. Coded as 0 = right-censoring, and 1 = event.
integer: time-independent binary explanatory variable.
numeric: time-independent continuous explanatory variable.
data(dataLong)
data(dataLong)
deviance
returns the deviance based on the conditional likelihood associated with the survival part.deviance
returns the deviance based on the conditional likelihood associated with the survival part.
deviance(object, M = 1000, conditional = "survival", verbose = TRUE)
deviance(object, M = 1000, conditional = "survival", verbose = TRUE)
object |
an object inheriting from class 'Bqrjm'. |
M |
an integer indicating the number of draws used for the approximation of the integral with respect to random effects, M=1000 by default. |
conditional |
is "survival" by default (only this one is implemented until now). |
verbose |
A logical indicating if information about method's progress (included progress bars for each step) must be printed (default to TRUE). Adds a small extra overload. |
An object which is a list with the following elements:
deviance
Numerical object returning the deviance
likelihood
(Conditional) likelihood
sims.list
list of individual quantities as likelihood, draws of random effects, hazard and survival functions
control
list of arguments giving details about the deviance
Antoine Barbieri and Baptiste Courrèges
#---- load data data(dataLong) #---- Fit quantile regression joint model for the median qrjm_50 <- qrjm(formFixed = y ~ visit, formRandom = ~ visit, formGroup = ~ ID, formSurv = survival::Surv(time, event) ~ X1 + X2, survMod = "weibull", param = "value", timeVar= "visit", data = dataLong, save_va = TRUE, parallel = FALSE, tau = 0.5) deviance(qrjm_50, M=200)
#---- load data data(dataLong) #---- Fit quantile regression joint model for the median qrjm_50 <- qrjm(formFixed = y ~ visit, formRandom = ~ visit, formGroup = ~ ID, formSurv = survival::Surv(time, event) ~ X1 + X2, survMod = "weibull", param = "value", timeVar= "visit", data = dataLong, save_va = TRUE, parallel = FALSE, tau = 0.5) deviance(qrjm_50, M=200)
lqm
fits linear quantile regression modelFunction using 'JAGS' software to estimate the linear quantile regression model assuming asymmetric Laplace distribution for residual error.
lqm( formula, data, tau = 0.5, n.chains = 3, n.iter = 10000, n.burnin = 5000, n.thin = 1, n.adapt = NULL, save_jagsUI = TRUE, parallel = FALSE )
lqm( formula, data, tau = 0.5, n.chains = 3, n.iter = 10000, n.burnin = 5000, n.thin = 1, n.adapt = NULL, save_jagsUI = TRUE, parallel = FALSE )
formula |
formula for the quantile regression including response variable |
data |
dataset of observed variables |
tau |
the quantile(s) to be estimated. This must be a number between 0 and 1, otherwise the execution is stopped. If more than one quantile is specified, rounding off to the 4th decimal must give non–duplicated values of |
n.chains |
the number of parallel chains for the model; default is 1. |
n.iter |
integer specifying the total number of iterations; default is 10000 |
n.burnin |
integer specifying how many of |
n.thin |
integer specifying the thinning of the chains; default is 1 |
n.adapt |
integer specifying the number of iterations to use for adaptation; default is |
save_jagsUI |
If |
parallel |
see |
A Blqm
object which is a list with the following elements:
mean
list of posterior mean for each parameter
median
list of posterior median for each parameter
modes
list of posterior mode for each parameter
StErr
list of standard error for each parameter
StDev
list of standard deviation for each parameter
Rhat
Gelman and Rubin diagnostic for all parameters
ICs
list of the credibility interval at 0.95 for each parameters excepted for covariance parameters in covariance matrix of random effects. Otherwise, use save_jagsUI=TRUE to have the associated quantiles.
data
data included in argument
sims.list
list of the MCMC chains of the parameters and random effects
control
list of arguments giving details about the estimation
W
list including both posterior mean and posterior standard deviation of subject-specific random variable W
out_jagsUI
only if save_jagsUI=TRUE
in argument: list including posterior mean, median, quantiles (2.5%, 25%, 50%, 75%, 97.5%), standard deviation for each parameter and each random effect.
Moreover, this list also returns the MCMC draws, the Gelman and Rubin diagnostics (see output of jagsUI objects)
Antoine Barbieri
#---- Use data data(wave) #---- Fit regression model for the first quartile lqm_025 <- lqm(formula = h110d~vent_vit_moy, data = wave, n.iter = 1000, n.burnin = 500, tau = 0.25) #---- Get the posterior mean of parameters lqm_025$mean #---- Visualize the trace for beta parameters jagsUI::traceplot(lqm_025$out_jagsUI, parameters = "beta" ) #---- Summary of output summary(lqm_025)
#---- Use data data(wave) #---- Fit regression model for the first quartile lqm_025 <- lqm(formula = h110d~vent_vit_moy, data = wave, n.iter = 1000, n.burnin = 500, tau = 0.25) #---- Get the posterior mean of parameters lqm_025$mean #---- Visualize the trace for beta parameters jagsUI::traceplot(lqm_025$out_jagsUI, parameters = "beta" ) #---- Summary of output summary(lqm_025)
lqmm
fits linear quantile mixed modelFunction using 'JAGS' software to estimate the linear quantile mixed model assuming asymmetric Laplace distribution for residual error.
lqmm( formFixed, formRandom, formGroup, data, tau, RE_ind = FALSE, n.chains = 3, n.iter = 10000, n.burnin = 5000, n.thin = 1, n.adapt = NULL, precision = 10, save_jagsUI = TRUE, parallel = FALSE )
lqmm( formFixed, formRandom, formGroup, data, tau, RE_ind = FALSE, n.chains = 3, n.iter = 10000, n.burnin = 5000, n.thin = 1, n.adapt = NULL, precision = 10, save_jagsUI = TRUE, parallel = FALSE )
formFixed |
formula for fixed part of longitudinal submodel with response variable |
formRandom |
formula for random part of longitudinal submodel without response variable |
formGroup |
formula specifying the cluster variable (e.g. = ~ subject) |
data |
dataset of observed variables |
tau |
the quantile(s) to be estimated. This must be a number between 0 and 1, otherwise the execution is stopped. If more than one quantile is specified, rounding off to the 4th decimal must give non–duplicated values of |
RE_ind |
Boolean denoting if the random effects are assumed independent ; default is |
n.chains |
the number of parallel chains for the model; default is 1. |
n.iter |
integer specifying the total number of iterations; default is 10000 |
n.burnin |
integer specifying how many of |
n.thin |
integer specifying the thinning of the chains; default is 1 |
n.adapt |
integer specifying the number of iterations to use for adaptation; default is |
precision |
variance by default for vague prior distribution |
save_jagsUI |
If |
parallel |
see |
A Blqmm
object is a list with the following elements:
mean
list of posterior mean for each parameter
median
list of posterior median for each parameter
modes
list of posterior mode for each parameter
StErr
list of standard error for each parameter
StDev
list of standard deviation for each parameter
ICs
list of the credibility interval at 0.95 for each parameters excepted for covariance parameters in covariance matrix of random effects. Otherwise, use save_jagsUI=TRUE to have the associated quantiles.
data
data included in argument
sims.list
list of the MCMC chains of the parameters and random effects
control
list of arguments giving details about the estimation
random_effect
list for each quantile including both posterior mean and posterior standard deviation of subject-specific random effects
out_jagsUI
only if save_jagsUI=TRUE
in argument: list including posterior mean, median, quantiles (2.5%, 25%, 50%, 75%, 97.5%), standart deviation for each parameter and each random effect.
Moreover, this list also returns the MCMC draws, the Gelman and Rubin diagnostics (see output of jagsUI objects)
Antoine Barbieri
Marco Geraci and Matteo Bottai (2014). Linear quantile mixed models. Statistics and Computing, 24(3):461-479. doi: 10.1007/s11222-013-9381-9.
#---- Use dataLong dataset data(dataLong) #---- Fit regression model for the first quartile lqmm_075 <- lqmm(formFixed = y ~ visit, formRandom = ~ visit, formGroup = ~ ID, data = dataLong, tau = 0.75, n.iter = 10000, n.burnin = 1000) #---- Get the posterior means lqmm_075$mean #---- Visualize the trace for beta parameters jagsUI::traceplot(lqmm_075$out_jagsUI, parameters = "beta") #---- Summary of output summary(lqmm_075)
#---- Use dataLong dataset data(dataLong) #---- Fit regression model for the first quartile lqmm_075 <- lqmm(formFixed = y ~ visit, formRandom = ~ visit, formGroup = ~ ID, data = dataLong, tau = 0.75, n.iter = 10000, n.burnin = 1000) #---- Get the posterior means lqmm_075$mean #---- Visualize the trace for beta parameters jagsUI::traceplot(lqmm_075$out_jagsUI, parameters = "beta") #---- Summary of output summary(lqmm_075)
qrjm
fits quantile regression joint modelFunction using 'JAGS' software via jagsUI
package to estimate the quantile regression joint model assuming asymmetric Laplace distribution for residual error.
Joint modeling concerns longitudinal data and time-to-event
qrjm( formFixed, formRandom, formGroup, formSurv, survMod = "weibull", param = "value", timeVar, data, tau, RE_ind = FALSE, n.chains = 3, n.iter = 10000, n.burnin = 5000, n.thin = 1, n.adapt = 5000, precision = 10, C = 1000, save_jagsUI = TRUE, save_va = FALSE, parallel = FALSE )
qrjm( formFixed, formRandom, formGroup, formSurv, survMod = "weibull", param = "value", timeVar, data, tau, RE_ind = FALSE, n.chains = 3, n.iter = 10000, n.burnin = 5000, n.thin = 1, n.adapt = 5000, precision = 10, C = 1000, save_jagsUI = TRUE, save_va = FALSE, parallel = FALSE )
formFixed |
formula for fixed part of longitudinal submodel with response variable |
formRandom |
formula for random part of longitudinal submodel without response variable |
formGroup |
formula specifying the cluster variable (e.g. = ~ subject) |
formSurv |
survival formula as formula in survival package for latency submodel |
survMod |
specifying the baseline risk function for Cox proportional hazard model (only "weibull" is available until now) |
param |
shared association including in joint modeling: the classical shared random effects or the current value denoting by "sharedRE" (default) or "value", respectively. |
timeVar |
string specify the names of time variable (time of repeated measurements) |
data |
dataset of observed variables |
tau |
the quantile(s) to be estimated. This must be a number between 0 and 1, otherwise the execution is stopped. If more than one quantile is specified, rounding off to the 4th decimal must give non–duplicated values of |
RE_ind |
Boolean denoting if the random effects are assumed independent ; default is |
n.chains |
the number of parallel chains for the model; default is 1. |
n.iter |
integer specifying the total number of iterations; default is 10000 |
n.burnin |
integer specifying how many of |
n.thin |
integer specifying the thinning of the chains; default is 1 |
n.adapt |
integer specifying the number of iterations to use for adaptation; default is 5000 |
precision |
variance by default for vague prior distribution |
C |
value used in the zero trick; default is 1000. |
save_jagsUI |
If |
save_va |
If |
parallel |
see |
A Bqrjm
object is a list with the following elements:
mean
list of posterior mean for each parameter
median
list of posterior median for each parameter
modes
list of posterior mode for each parameter
StErr
list of standard error for each parameter
StDev
list of standard deviation for each parameter
ICs
list of the credibility interval at 0.95 for each parameters excepted for covariance parameters in covariance matrix of random effects. Otherwise, use save_jagsUI=TRUE to have the associated quantiles.
data
data included in argument
sims.list
list of the MCMC chains of the parameters and random effects
control
list of arguments giving details about the estimation
random_effect
list for each quantile including both posterior mean and posterior standard deviation of subject-specific random effects
out_jagsUI
only if save_jagsUI=TRUE
in argument: list including posterior mean, median, quantiles (2.5%, 25%, 50%, 75%, 97.5%), standart deviation for each parameter and each random effect.
Moreover, this list also returns the MCMC draws, the Gelman and Rubin diagnostics (see output of jagsUI objects)
Antoine Barbieri
Ming Yang, Sheng Luo, and Stacia DeSantis (2019). Bayesian quantile regression joint models: Inference and dynamic predictions. Statistical Methods in Medical Research, 28(8):2524-2537. doi: 10.1177/0962280218784757.
#---- load data data(dataLong) #---- Fit quantile regression joint model for the first quartile qrjm_75 <- qrjm(formFixed = y ~ visit, formRandom = ~ visit, formGroup = ~ ID, formSurv = Surv(time, event) ~ X1 + X2, survMod = "weibull", param = "value", timeVar= "visit", data = dataLong, tau = 0.75) #---- Visualize the trace for beta parameters jagsUI::traceplot(qrjm_75$out_jagsUI, parameters = "beta") #---- Get the estimated coefficients: posterior means qrjm_75$mean #---- Summary of output summary(qrjm_75)
#---- load data data(dataLong) #---- Fit quantile regression joint model for the first quartile qrjm_75 <- qrjm(formFixed = y ~ visit, formRandom = ~ visit, formGroup = ~ ID, formSurv = Surv(time, event) ~ X1 + X2, survMod = "weibull", param = "value", timeVar= "visit", data = dataLong, tau = 0.75) #---- Visualize the trace for beta parameters jagsUI::traceplot(qrjm_75$out_jagsUI, parameters = "beta") #---- Get the estimated coefficients: posterior means qrjm_75$mean #---- Summary of output summary(qrjm_75)
Data including environmental measurements around Bordeaux from CANDHIS database and data from InfoClimat website. CANDHIS national in situ wave measurement database. The measurements were carried out within the framework of a collaboration between the Grand Port Maritime de Nantes St-Nazaire, the École Centrale de Nantes and CEREMA. In addition, data from the InfoClimat site over the same period are used.
data(wave)
data(wave)
A data.frame with 453 observations (rows) and 25 variables with explicit names. The first variables are:
date of measure
temperature
pressure
Humidity
Dew point temperature
visibility
wind speed average
maximum of wind speed
cumulative rainfall by day
InfoClimat (https://www.infoclimat.fr/climatologie/stations_principales.php?)
data(wave)
data(wave)