arbutus_plot_point: Plot the simulated test statistics versus observed test...

View source: R/plotting-fxns.R

arbutus_plot_pointR Documentation

Plot the simulated test statistics versus observed test statistic (point estimate of parameters)

Description

Plots a histogram of the simulated values along with the observed values for a single test statistic when a point estimate is used

Usage

arbutus_plot_point(
  x,
  stat,
  xlab = NA,
  ylab = "Counts",
  col = NA,
  breaks = NA,
  las = 1,
  lwd = 3,
  legend = TRUE,
  legend.pos = "topright",
  cex = 1,
  ...
)

Arguments

x

an arbutus object inherited from compare_pic_stat

stat

the name of the test statistic to plot

xlab

x-axis label. Defaults to stat.

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 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 par).

lwd

plot parameter (see par).

legend

logical, specifying whether a legend should be included.

legend.pos

postiion of the legend (see legend).

cex

plot parameter for legend (see par).

...

additional arguments to be passed to plot

Details

This function is designed to give researchers a quick visual inspection of model adequacy by plotting the simulated distribution of a test statistic along with the empirical estimate.

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.

plot.arbutus wraps this function and allows results from all test statistics to be viewed in a single plot.

See Also

arbutus, compare_pic_stat, plot.arbutus

Examples

## 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)
arbutus_plot_point(modelad, "m.sig")


## 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 <- arbutus(f)
arbutus_plot_point(modelad.bm, "m.sig")

## End(Not run)


mwpennell/arbutus documentation built on Oct. 6, 2022, 10 a.m.