summary.qrjoint {qrjoint} | R Documentation |
Summary Method for qrjoint Model Fit
Description
Summarize model fit, including MCMC details, for qrjoint
.
Usage
## S3 method for class 'qrjoint'
summary(object, ntrace = 1000, burn.perc = 0.5,
plot.dev = TRUE, more.details = FALSE, ...)
Arguments
object |
a fitted model of the class 'qrjoint'. |
ntrace |
number of draws to be included in trace plots |
burn.perc |
fraction of MCMC draws to be discarded as burn-in. |
plot.dev |
logical indicator of whether to show trace plot of deviance |
more.details |
logical indicating whether other details from MCMC are to be plotted |
... |
a limited number of plotting controls that are passed onto the deviance plot |
Value
Displays the trace of the deviance statistic. More details include trace plots of of the proximity parameter of each GP, a plot of Geweke p-values for (from geweke.diag
) convergence of each model parameter and an image plot of parameter correlation. Also prints two versions of Watanabe AIC.
The following quantities are returned invisibly.
deviance |
vector deviance statistic of the samples parameter draws |
pg |
a matrix with |
prox |
posterior draws of proximity in the form of a |
ll |
a matrix of |
ql |
a matrix of |
waic |
Two versions of Watanabe AIC from Gelman, Hwang and Vehtari (2014). |
References
Gelman, A., Hwang, J., and Vehtari, A. (2014). Understanding predictive information criterion for Bayesian models. Stat Comput, 24, 997-1016.
See Also
qrjoint
and coef.qrjoint
.
Examples
# 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 40 posterior samples from 80 iterations (thin = 2) is for
# illustration only. For practical model fitting, increase iterations,
# e.g. nsamp = 500, thin = 20
fit.qrj <- qrjoint(BetaPlasma ~ Age + Sex + SmokStat + Quetelet + VitUse + Calories +
Fat + Fiber + Alcohol + Cholesterol + BetaDiet, plasma, nsamp = 40, thin = 2)
summ <- summary(fit.qrj, more = TRUE)
## Not run:
# Visually assess uniformity of quantile levels with histogram and qqplot
# Notes: Can assess across all MCMC draws (as below) or for single iteration;
# adjustments to quantile levels will be needed for censored observations
hist(summ$ql, breaks=40, freq=F)
curve(dunif(x),add=T)
qqplot(summ$ql, qunif(ppoints(length(summ$ql))),xlab="actual", ylab="theoretical")
abline(0,1)
# Visually assess linearity assumption using quantile levels
# Notes: Can assess across all MCMC draws or for single iteration (as below)
# Loess gives visual of center of quantile levels across covariate;
# trend line should be near 0.5
library(ggplot2)
use <- sample(1:ncol(summ$ql),1)
plasma$qlsamp <- summ$ql[,use]
ggplot(data=plasma, aes(x=Age, y=qlsamp)) + geom_point() + geom_smooth(se=F,
method="loess")
# Violin plot allows for assessment of entire distribution across covariate;
# densities within decile bins should be blocky-uniform
cut_dec <- function(x) factor(cut(x, quantile(x,0:10/10),inc=TRUE),labels=1:10)
ggplot(data=plasma, aes(x=cut_dec(Age), y=qlsamp)) + geom_violin() +
xlab("Age Decile Bins")
## End(Not run)