Learn R Programming

qrjoint (version 2.0-9)

coef.qrjoint: Regression Coefficient Extraction from qrjoint Model Fit

Description

Post process MCMC output from qrjoint to create summaries of intercept and slope function estimates

Usage

# S3 method for qrjoint
coef(object, burn.perc = 0.5, nmc = 200, plot = FALSE, show.intercept = TRUE, 
        reduce = TRUE, ...)

Value

Extracts posterior draws of intercept and slope functions from saved draws of model parameters. A plot may be obtained if plot = TRUE. A list is returned invisibly with three fields.

beta.samp

a three-dimensional array of posterior samples of \(\beta_j\). Its dimensions are L (length of tau.grid) x p+1 (intercept + slopes) x nmc (retained posterior draws).

beta.est

a three-dimensional array containing posterior summaries (2.5th, 50th, and 97.5th percentiles) of \(\beta_j\). Its dimensions are L (length of tau.grid) x p+1 (intercept + slopes) x 3 (posterior summaries).

parametric

a matrix with 3 columns giving the estimate (posterior median) and the lower and upper end points of the 95% posterior credible interval for \(\gamma_0\), \(\gamma\), \(\sigma\), and, \(\nu\).

Arguments

object

a fitted model of the class qrjoint.

burn.perc

a positive fraction indicating what fraction of the saved draws are to be discarded as burn-in

nmc

integer giving the number of samples, post burn-in, to be used in Monte Carlo averaging

plot

logical indicating if plots are to be made

show.intercept

whether to plot the intercept curve when plot = TRUE

reduce

logical indicating if the tail-expanded grid of tau values is to be reduced to the regular increment grid

...

limited plotting parameters that are passed onto the call of getBands

See Also

qrjoint and summary.qrjoint for model fitting under qrjoint. Also see getBands for plotting credible bands for coefficients.

Examples

Run this code
## Plasma data analysis

# recoding variables
data(plasma)
plasma$Sex <- as.factor(plasma$Sex)
plasma$SmokStat <- as.factor(plasma$SmokStat)
plasma$VitUse <- 3 - plasma$VitUse
plasma$VitUse <- as.factor(plasma$VitUse)

# model fitting with 50 posterior samples from 100 iterations (thin = 2)
fit.qrj <- qrjoint(BetaPlasma ~ Age + Sex + SmokStat + Quetelet + VitUse + Calories + 
        Fat + Fiber + Alcohol + Cholesterol + BetaDiet, plasma, nsamp = 40, thin = 2)

if (FALSE) {
betas <- coef(fit.qrj) ## no plots
betas <- coef(fit.qrj, plot = TRUE) ## estimates are plotted
}

Run the code above in your browser using DataLab