Learn R Programming

ecocbo (version 1.0.0)

plot_power: Plot Statistical Power and Pseudo-F Distributions

Description

Visualizes the statistical power of a study as a function of the sampling effort. The power curve plot illustrates how power increases with sample size, while the density plot highlights overlapping areas where \(\alpha\) and \(\beta\) are significant.

Usage

plot_power(
  data,
  cbo = NULL,
  n = NULL,
  m = NULL,
  method = "power",
  completePlot = TRUE
)

Value

A plot displaying:

  • If method = "power", power curves for different values of m, with the selected n highlighted in red.

  • If method = "density": a density plot of observed pseudo-F values with a vertical line indicating significance from sim_beta().

  • If method = "both": a composite figure with both the power curve and the density plot.

  • If method = "surface": a surface plot for the statistical power in different sampling designs.

The selected values of m, n, and the corresponding component of variation are displayed in all cases.

Arguments

data

Object of class "ecocbo_beta" obtained from sim_beta().

cbo

Optional. Object of class "cbo_result" obtained from sim_cbo(). If this is included, plot_power() uses the optimal values that have been already calculated.

n

Optional. Integer. Number of samples n within the selected m. Defaults to NULL, and the function selects the number of samples yielding a power close to \(1 - \alpha\).

m

Optional. Integer. Number of replicates m to use for power computation. Defaults to NULL, in which case the function selects the number of sites that result in a sampling effort that is close to \(1 - \alpha\).

method

Character. Type of plot to generate:

  • "power": Plots the power curve.

  • "density": Plots the density distribution of pseudo-F values.

  • "both": Displays both plots side by side.

  • "surface": Displays a 3d surface plot of the power curves for nested factors experiments.

completePlot

Logical. Is the plot to be drawn complete? If TRUE the plot will be trimmed to present a better distribution of the density plot.

Author

Edlin Guerra-Castro (edlinguerra@gmail.com), Arturo Sanchez-Porras

References

  • Underwood, A. J. (1997). Experiments in ecology: their logical design and interpretation using analysis of variance. Cambridge university press.

  • Underwood, A. J., & Chapman, M. G. (2003). Power, precaution, Type II error and sampling design in assessment of environmental impacts. Journal of Experimental Marine Biology and Ecology, 296(1), 49-70.

See Also

sim_beta() scompvar() sim_cbo() prep_data()

Examples

Run this code
# Power curve visualization
plot_power(data = epiBetaR, method = "power")

# Density plot of pseudo-F values
plot_power(data = betaNested, method = "density")

# Composite plot with both power curve and density plot
plot_power(data = betaNested, method = "both")

Run the code above in your browser using DataLab