checkFit.RdThis function calculates the log-likelihood of a tsbart model fit, and optionally the WAIC.
checkFit(y, mcmcdraws, probit, doWaic, sig=NULL, yobs=NULL)
| y | A vector with continuous response values. Required, defaults to NULL. |
|---|---|
| mcmcdraws | A matrix containing the MCMC draws for the tsbart fit. Rows are MCMC iterations, columns are observations. Number of columns must match length of y. Required, defaults to NULL. |
| probit | Boolean indicator for whether model is probit. |
| doWaic | Boolean indicator for whether to calculate WAIC in addition to log-likelihood. |
| sig | A vector with sigma MCMC draws. Required if probit=FALSE, defaults to NULL. Must be NULL if probit=TRUE. |
| yobs | A vector of 0/1 indicators for each observation. Required if probit=TRUE, defaults to NULL. |
A list containing the following components:
The waic value for the model fit.
The log-likelihood for all mcmc draws.
if (FALSE) { # Function call example is as follows. Let fit be the output of tsbart(). ## In-sample example: checkFit(y=y, mcmcdraws = fit[["mcmcdraws"]], probit=FALSE, doWaic=TRUE, sig = fit[["sigma"]], yobs = NULL) ## Out-of-sample example: checkFit(y=y_pred, mcmcdraws = fit[["mcmcdraws_oos"]], probit=FALSE, doWaic=TRUE, sig = fit[["sigma"]], yobs = NULL) }