fitplot: Plot fitted values from MBNMA model

Description Usage Arguments Details Value Examples

View source: R/plot.functions.R

Description

Plot fitted values from MBNMA model

Usage

1
2
3
4
5
6
7
fitplot(
  mbnma,
  disp.obs = TRUE,
  n.iter = mbnma$BUGSoutput$n.iter,
  n.thin = mbnma$BUGSoutput$n.thin,
  ...
)

Arguments

mbnma

An S3 object of class "mbnma" generated by running a dose-response MBNMA model

disp.obs

A boolean object to indicate whether raw data responses should be plotted as points on the graph

n.iter

number of total iterations per chain (including burn in; default: 2000)

n.thin

thinning rate. Must be a positive integer. Set n.thin > 1 to save memory and computation time if n.iter is large. Default is max(1, floor(n.chains * (n.iter-n.burnin) / 1000)) which will only thin if there are at least 2000 simulations.

...

Arguments to be sent to ggplot2::geom_point() or ggplot2::geom_line()

Details

Fitted values should only be plotted for models that have converged successfully. If fitted values (theta) have not been monitored in mbnma$parameters.to.save then additional iterations will have to be run to get results for these.

Value

Generates a plot of fitted values from the MBNMA model and returns a list containing the plot (as an object of class(c("gg", "ggplot"))), and a data.frame of posterior mean fitted values for each observation.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Using the triptans data
network <- mbnma.network(HF2PPITT)

# Run an Emax dose-response MBNMA and predict responses
emax <- mbnma.emax(network, method="random")

# Plot fitted values and observed values
fitplot(emax)

# Plot fitted values only
fitplot(emax, disp.obs=FALSE)

# A data frame of fitted values can be obtained from the object
#returned by `fitplot`
fits <- fitplot(emax)
head(fits$fv)

MBNMAdose documentation built on Sept. 13, 2020, 5:08 p.m.