View source: R/plotting-fxns.R
plot.arbutus | R Documentation |
Plots a histogram of the simulated values along with
the observed values for a single test statistic. Either a point estimate or
distribution of observed values may be used. Is the generic plot
function for objects of class arbutus
.
## S3 method for class 'arbutus' plot( x, xlab = NA, ylab = "Counts", col = NA, breaks = NA, las = 1, lwd = 3, legend = TRUE, legend.pos = "topright", cex = 1, n.row = 2, n.col = NA, mar = c(5, 4, 2, 2), ... )
x |
an |
xlab |
x-axis label. Defaults to |
ylab |
y-axis label. Defaults to "Counts". |
col |
colours used in plot. The first colour corresponds to the histogram of simulated test statistics. The second colour to the line, or histogram, representing the observed value of the test statistic. If no argument is supplied, the function uses the default colours. |
breaks |
the number of breaks in the histogram. Defaults to 20. |
las |
plot parameter (see |
lwd |
plot parameter (see |
legend |
logical, specifying whether a legend should be included (see details). |
legend.pos |
postiion of the legend (see |
cex |
plot parameter for legend (see |
n.row |
number of rows to plot when plotting multiple test statistics. Defaults to 2. |
n.col |
number of columns to plot when plotting multiple test statistics.
Defaults to |
mar |
margins for each plot. Defaults to 5,4,2,2. |
... |
additional arguments to be passed to plot |
This function is designed to give researchers a quick visual inspection of model adequacy by plotting the simulated distribution of all test statistics versus the emprical values.
This function is a simply a wrapper for the functions
arbutus_plot_point
and arbutus_plot_dist
. It
creates plots for all test statistics used in arbutus
and
compare_pic_stat
. The function can be supplied either a point
estimate for the observed test statistics or a distribution of estimates.
If the empirical estimate lies in the tails of the distribution of simulated test statistics, the model can be rejected as inadequate.
The p-values corresponding to this plot can be obtained with the function
pvalue_arbutus
.
We are still working on a general function for plotting legends. For the time
being, if legend=TRUE
, a legend will appear with each test statistic.
This is obviously not ideal, but we are working on it.
If users wish to create their own plots, all of the information is stored
in the arbutus
object. x$obs
contains a data.frame of observed
test statistics and x$sim
, a data.frame of simulated test statistics.
arbutus
, compare_pic_stat
,
arbutus_plot_point
, arbutus_plot_dist
## finch data data(finch) phy <- finch$phy data <- finch$data[,1] ## pretend that the tree has already been rescaled modelad <- arbutus(phy, data=data, nsim=20) plot(modelad) ## Not run: ## use diversitree to fit a BM model with ML require(diversitree) lik <- make.bm(phy, data) f <- find.mle(lik, x.init=1) modelad.bm.ml <- arbutus(f) plot(modelad.bm.ml, legend=FALSE) ## use diversitree to fit a BM model with MCMC m <- mcmc(lik, x.init=1, nsteps=1000, w=1, print.every=0) modelad.bm.mcmc <- arbutus(m, sample=100) plot(modelad.bm.mcmc) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.