poweRbal_data-plot function

Plot method for poweRbal_data objects

Plot method for poweRbal_data objects

This function generates a plot for an object of class poweRbal_data. Creates a bar plot if alt_model_params and x$alt_model_params

= NULL and a line plot otherwise if this information is given.

## S3 method for class 'poweRbal_data' plot( x, tss_names = NULL, tss_colors = NULL, sig_lvl = NULL, legend_pos = "topright", alt_model_names = NULL, alt_model_params = NULL, tss_ltys = NULL, alt_model_family = NULL, ... )

Arguments

  • x: An object of class poweRbal_data, which is a list containing one mandatory element, power, and several optional elements:

    • power: A numeric matrix containing the power values (one row per TSS and one column per alternative model).
    • accept_regions: A numeric matrix containing information on the region of acceptance (one row per TSS and four columns).
    • CIradius: A numeric matrix containing the confidence interval radii (one row per TSS and one column per alternative model).
    • actual_sample_sizes: A numeric vector containing the actual sample sizes under each alternative model, as some models do not always successfully generate trees.
    • alt_model_params: A numeric vector (one element per alternative model) containing the values of a tree model parameter. This is only suitable if the alternative models all belong to the same tree model family and differ only in one parameter.
    • Other input data from the powerComp() function, such as tss, null_model, alt_models, n, distribs, N_null, N_alt, test_type, correction, and sig_lvl.
  • tss_names: Vector of characters/expression of the TSS names (default = NULL). If none are provided, x$tss is used for the names of the TSS if existent and otherwise the row names of x$power

    are used.

  • tss_colors: Vector of colors for the TSS (default = NULL).

  • sig_lvl: Level of significance (default=0.05, must be >0 and <1) depicted as a dashed horizontal line. Not depicted if set to NULL.

  • legend_pos: Character specifying where the legend is displayed (default = "topright"). No legend is displayed if set to NULL.

  • alt_model_names: Vector of characters/expression of the model names (default = NULL). If none are provided, the column names of x$power are used as names for the models.

    Only used if alt_model_params and x$alt_model_params = NULL.

  • alt_model_params: Numeric vector containing the parameter values of the representatives of the tree model (default = NULL). If none are provided, x$alt_model_params is used if existent.

  • tss_ltys: Vector of line types for the TSS (default = NULL).

    Not used if alt_model_params and x$alt_model_params = NULL.

  • alt_model_family: Vector of characters/expressions of the name of the tree model family and of the parameter (default = NULL), e.g. c("Aldous\'", expression(beta)). If none is provided, the first column name of x$power is used.

    Not used if alt_model_params and x$alt_model_params = NULL.

  • ...: Additional arguments passed to the plot function.

Returns

plot.poweRbal_data No return value, as the primary purpose of this function is the side effect (plotting).

Examples

# Plotting a 'poweRbal_data' object: pc1 <- powerComp(tss = c("Sackin", "Colless", "B1I"), alt_models = list(list("aldous",-1), "pda", "etm"), n = 8L, N_null = 40L, N_alt = 20L) plot(pc1) # Plotting a power comparison with a tree model family pc2 <- powerComp(tss = c("Sackin", "Colless", "B1I"), alt_models = list(list("aldous", -1.5), list("aldous", -1),list("aldous", -0.5), list("aldous", 0),list("aldous", 0.5)), n=20L, N_null = 20L, N_alt = 10L, distribs = "sampled") # Create a bar plot or ... plot(pc2) # ... a line plot by specifying 'alt_model_params'. plot(pc2, alt_model_params = c(-1.5,-1,-0.5,0,0.5), tss_names = getTSSnames(c("Sackin", "Colless", "B1I")), tss_colors = getTSScolors(c("Sackin", "Colless", "B1I")), alt_model_family = c("Aldous\'", expression(beta)), ylim = c(0,1))
  • Maintainer: Sophie Kersting
  • License: GPL (>= 3)
  • Last published: 2024-08-16

Useful links