Learn R Programming

nestedRanksTest (version 0.2)

plot.htest_boot: Diagnostic plot of result held in htest_boot object

Description

plot.htest_boot creates a diagnostic plot of a return value held in a list of class 'htest_boot', as returned by e.g., nestedRanksTest. The plot contains a histogram of the null distribution generated by' bootstrapping plotted with hist, and a verticle line indicating the observed value plotted with abline.

Usage

"plot"(x, breaks, col = "lightblue", border = NA, digits = getOption("digits"), main = paste(sep = "", x$method, ", ", x$data.name, "\n", names(x$statistic), " = ", format(signif(x$statistic, max(1L, digits - 2L))), ", P = ", format.pval(x$p.value, digits = max(1L, digits - 3L))), xlab = "Distribution of Z-scores", ylab = paste(sep = "", "Frequency (out of ", x$n.iter, ")"), p.col = "red", p.lty = 2, p.lwd = 2, ...)

Arguments

x
Value of class 'htest_boot'
breaks
The number of breaks to use when plotting the distribution, the default is calculated from n.iter of the call to nestedRanksTest
col
Fill color for histogram bars, passed to hist.
border
Border color for histogram bars, passed to hist
digits
Number of digits to use for statistic and p-value, the default is taken from the "digits" option
main
Main title, passed to hist
xlab
X-axis label, passed to hist
ylab
Y-axis label, passed to hist
p.col
Observed value line colour, passed to abline
p.lty
Observed value line type, passed to abline
p.lwd
Observed value line width, passed to abline
...
Additional arguments passed to hist and abline for plotting

Value

None

Details

If there is no null distribution included in the class, e.g., because the' options lightweight = TRUE or n.iter = 1 were given to nestedRanksTest, this function produces an error.

See Also

print.htest_boot for printing test results, hist and abline for plotting options, and nestedRanksTest for one test that returns an object of class 'htest_boot'

Examples

Run this code
require(graphics)

data(woodpecker_multiyear)

## n.iter set to 1000 to shorten completion time
res.a <- nestedRanksTest(Distance ~ Year | Granary, n.iter = 1000,
                         data = woodpecker_multiyear,
                         subset = Species == "agrifolia")
res.l <- nestedRanksTest(Distance ~ Year | Granary, n.iter = 1000,
                         data = woodpecker_multiyear,
                         subset = Species == "lobata")

opa = par(mfrow = c(2, 1))
## Defaults
plot(res.l)
## Modify colours, line type and main title
plot(res.a, main = "Quercus agrifolia", col = "lightgreen",
     p.col = "brown4", p.lty = 1)
par(opa)

Run the code above in your browser using DataLab