model.qbld {qbld} | R Documentation |
QBLD Sampler
Description
Runs the QBLD sampler as in Rahman and Vossmeyer(2019) and outputs a ‘qbld’ class object which consists of Markov chains for Beta(the fixed effects estimate), Alpha(the random effects estimate), and Varphi2 (as per the model), of which Beta and Varphi2 are of interest.
Usage
model.qbld(fixed_formula, data, id = "id", random_formula = ~1, p = 0.25,
b0 = 0, B0 = 1, c1 = 9, d1 = 10, method = c("block","unblock"),
nsim, burn = 0, summarize = FALSE, verbose = FALSE)
Arguments
fixed_formula |
: a description of the model to be fitted of the form
response~fixed effects predictors i.e |
data |
: data frame, NAs not allowed and should throw errors, factor variables are auto-converted, find airpollution.rda and locust.rda built into the package. |
id |
: variable name in the dataset that specifies individual profile. By default, |
random_formula |
: a description of the model to be fitted of the form
response~random effects predictors i.e |
p |
: quantile for the AL distribution on the error term, |
b0 , B0 |
: Prior model parameters for Beta. These are defaulted to 0 vector, and Identity matrix. |
c1 , d1 |
: Prior model parameters for Varphi2. These are defaulted to 9,10 (arbitrary) respectively. |
method |
: Choose between the "Block" vs "Unblock" sampler, Block is slower but produces lower correlation. |
nsim |
: number of simultions to run the sampler. |
burn |
: Burn in percentage, number between (0,1). Burn-in values are discarded and not used for summary calculations. |
summarize |
: Outputs a summary table (same as |
verbose |
: False by default. Spits out progress reports while the sampler is running. |
Details
For a detailed information on the sampler, please check the vignette.
Data are contained in a data.frame. Each element of the data argument must be identifiable by
a name. The simplest situation occurs when all subjects are observed at the same time points. The
id variable represent the individual profiles of each subject, it is expected a variable in the
data.frame that identifies the correspondence of each component of the response variable to the
subject that it belongs, by default is named id variable. Hence NA values are not valid.
For very low (<=0.025)
or very high (>=0.970)
values of p
, sampler forces to unblock version to avoid errors.
Block version in this case may lead to machine tolerance issues.
‘qbld’ object contains markov chains and sampler run information as attributes , and is compatible with S3 methods like summary,plot. make.qbld function can be used to convert a similar type-object to ‘qbld’ class.
Value
Returns ‘qbld’ class object. ‘qbld’ class contains the following :
-
Beta:
Matrix of MCMC samples of fixed-effects parameters. -
Alpha:
3-dimensional matrix of MCMC samples of random-effects parameters. -
Varphi2:
Matrix of MCMC samples for varphi2. -
nsim:
Attribute; No. of simulations of chain run. -
burn:
Attribute; Whether or not burn-in used. -
which:
Attribute; "block" or "unblock" sampler used
References
Rahman, Mohammad Arshad and Angela Vossmeyer, “Estimation and Applications of Quantile Regression for Binary Longitudinal Data,” Advances in Econometrics, 40B, 157-191, 2019.
See Also
A qbld object may be summarized by the summary function and visualized with the plot function.
Datasets : airpollution
, locust
Examples
data(airpollution)
output <- model.qbld(fixed_formula = wheeze~smoking+I(age^2), data = airpollution, id="id",
random_formula = ~1, p=0.25, nsim=1000, method="block", burn=0,
summarize=TRUE, verbose=FALSE)
plot(output)