plotFit: Plot Posterior Predictive Mean Frequencies

View source: R/plotFit.R

plotFitR Documentation

Plot Posterior Predictive Mean Frequencies

Description

Plots observed means/covariances of individual frequencies against the means/covariances sampled from the posterior distribution (posterior predictive distribution).

Usage

plotFit(fittedModel, M = 1000, stat = "mean", ...)

Arguments

fittedModel

fitted latent-trait or beta MPT model (traitMPT, betaMPT)

M

number of posterior predictive samples. As a maximum, the number of posterior samples in fittedModel is used.

stat

whether to plot mean frequencies ("mean") or covariances of individual frequencies ("cov")

...

arguments passed to boxplot

Details

If posterior predictive p-values were computed when fitting the model (e.g., by adding the argument traitMPT(...,ppp=1000) ), the stored posterior samples are re-used for plotting. Note that the last category in each MPT tree is dropped, because one category per multinomial distribution is fixed.

Examples

## Not run: 
# add posterior predictive samples to fitted model (optional step)
fittedModel$postpred$freq.pred <-
  posteriorPredictive(fittedModel, M = 1000)

# plot model fit
plotFit(fittedModel, stat = "mean")

## End(Not run)

TreeBUGS documentation built on May 31, 2023, 9:21 p.m.