pic_stat_dcdf_plot: Plot empirical cumulative distribution of contrasts versus a...

View source: R/plotting-fxns.R

pic_stat_dcdf_plotR Documentation

Plot empirical cumulative distribution of contrasts versus a normal distribution

Description

Plot the empirical cumulative distribution of the contrats derived from a rescaled 'unit.tree' against the ecdf of a normal distribution with mean 0 and sd of the observed contrasts.

Usage

pic_stat_dcdf_plot(
  x,
  xlab = "Sample quantiles",
  ylab = expression(hat(F)[n](x)),
  col = NA,
  las = 1,
  lwd = 2,
  legend = TRUE,
  legend.obs = "Contrasts",
  legend.norm = "Normal",
  cex = 1,
  ...
)

Arguments

x

a unit.tree object (see make_unit_tree).

xlab

x-axis label. Defaults to "Sample quantiles".

ylab

y-axis label. Defaults to "expression(hat(F)[n](x))".

col

plot colours. The first colour is the colour of the cdf of the contrats and the second is that of the normal distribution. If no argument, uses default colours.

las

plot parameter (see par). Defaults to 1.

lwd

plot parameter (see par). Defaults to 2.

legend

logical, whether legend should be plotted.

legend.obs

legend label for distribution of contrasts. Defaults to "Contrats"

legend.norm

legend label for normal distribution. Defaults to "Normal"

cex

plot parameter for legend (see link{par}). Defaults to 1.

...

additional arguments to be passed to plot.

Details

This function plots the empirical cumulative distribution function of the contrasts computed on the unit tree against that of a normal distribution. The empirical sd of the contrasts is used rather than the expected (i.e., 1) to distinguish non-normailty vs. inflated/deflated variance.

The D-statistics from the KS test (used in pic_stat_dcdf) is the maximum distance between the two curves. This is a default test test statistic in calculate_pic_stat.

If the model is adequate, the two curves should line up.

The function can currently only take a single unit.tree (does not integrate across unit.trees)

See Also

make_unit_tree, calculate_pic_stat, pic_stat_dcdf

Examples

## finch data
data(finch)
phy <- finch$phy
data <- finch$data[,1]

u <- make_unit_tree(phy, data=data)

pic_stat_dcdf_plot(u)


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