# Using the bayz model output

Bayz is set-up as other R model functions to produce an output object that can be used
for making summaries, plots, retrieve estimates, and many other things.
The standard use is the following workflow that will be familiar to R users:

library(BayzR)
fit = bayz(y~ ...)
summary(fit)

Bayz now supports the following R generic functions to work on the model output:
summary(), plot(), coef(), fixef(), ranef(), predict().
Below is a description of these
functions; standard help files for each are also available in R.

## Summary

The bayz summary() reports: 1) a table of Estimates of model coefficients (estimates
of fixed and random effects); 2) a table with convergence diagnostics and HPD
intervals for 'logged' parameters; 3) a table with proportional (scaled) variance
estimates, including HPD intervals.

## Plot

The bayz plot() function produces trace plots for the 'logged' parameters.

## Coef, fixef and ranef

The coef(), fixef() and ranef() functions supply ways to retrieve model estimates
of fixed and random effects from the bayz output object. Coef() retrieves
all coefficient estimates in a list with one data-frame for each model-term fitted.
The list elements are names as the original variables fitted in the model-terms.
Fixef() and ranef() are specialized versions of coef() that only retrieve
the fixed effects and random effects respectively.

## Predict

The predict() function in bayz is set-up to provide predictions for NA values
that were in the original data-frame used to fit the model. This allows
standard cross-validation work-flows to set parts of data to NA and run
the model to obtain prediction.