devplot {MBNMAdose} | R Documentation |
Plot deviance contributions from an MBNMA model
Description
Plot deviance contributions from an MBNMA model
Usage
devplot(
mbnma,
plot.type = "box",
facet = TRUE,
dev.type = "resdev",
n.iter = mbnma$BUGSoutput$n.iter/2,
n.thin = mbnma$BUGSoutput$n.thin,
...
)
Arguments
mbnma |
An S3 object of class |
plot.type |
Deviances can be plotted either as scatter points ( |
facet |
A boolean object that indicates whether or not to facet (by agent for |
dev.type |
STILL IN DEVELOPMENT FOR MBNMAdose! Deviances to plot - can be either residual
deviances ( |
n.iter |
number of total iterations per chain (including burn in; default: 2000) |
n.thin |
thinning rate. Must be a positive integer. Set
|
... |
Arguments to be sent to |
Details
Deviances should only be plotted for models that have converged successfully. If deviance
contributions have not been monitored in mbnma$parameters.to.save
then additional
iterations will have to be run to get results for these.
For MBNMAtime
, deviance contributions cannot be calculated for models with a multivariate likelihood (i.e.
those that account for correlation between observations) because the covariance matrix in these
models is treated as unknown (if rho = "estimate"
) and deviance contributions will be correlated.
Value
Generates a plot of deviance contributions and returns a list containing the
plot (as an object of class(c("gg", "ggplot"))
), and a data.frame of posterior mean
deviance/residual deviance contributions for each observation.
Examples
# Using the triptans data
network <- mbnma.network(triptans)
# Run an Emax dose-response MBNMA and predict responses
emax <- mbnma.run(network, fun=demax(), method="random")
# Plot deviances
devplot(emax)
# Plot deviances using boxplots
devplot(emax, plot.type="box")
# Plot deviances on a single scatter plot (not facetted by agent)
devplot(emax, facet=FALSE, plot.type="scatter")
# A data frame of deviance contributions can be obtained from the object
#returned by `devplot`
devs <- devplot(emax)
head(devs$dev.data)
# Other deviance contributions not currently implemented but in future
#it will be possible to plot them like so
#devplot(emax, dev.type="dev")