a2a {epiphy} | R Documentation |
Easily switch between different power law formulations.
Description
a2a
was designed to avoid headaches that are likely to occur when
working with different formulations of the binomial power law analysis.
Usage
a2a(x, ...)
## S3 method for class 'numeric'
a2a(
x,
slope,
n,
from = c("Ai", "ai", "AI", "aI"),
to = c("Ai", "ai", "AI", "aI"),
...
)
## S3 method for class 'list'
a2a(x, to = c("Ai", "ai", "AI", "aI"), ...)
Arguments
x |
Intercept parameter to be converted or a named list with the parameter to be converted ("Ai", "ai", "AI" or "aI"), the slope ("slope"), and the number of individual per sampling unit ("n"). |
... |
Additional arguments to be passed to other methods. |
slope |
Slope parameter. |
n |
Number of individuals per sampling unit. |
from |
Kind of the input intercept parameter ("Ai", "ai", "AI" or "aI"). |
to |
Desired kind for the ouput intercept parameter ("Ai", "ai", "AI" or "aI"). |
Details
The binomial power law can be expressed as: s_y^2 = (intercept)(s_{bin}^2)^b
.
But different forms of (intercept) are possible depending on the formulation of the
binomial power law.
Ai | ai | AI | aI | |
Ai | 1 | n^b | n^(2(b-1)) | n^(b-2) |
ai | n^(-b) | 1 | n^(b-2) | n^(-2) |
AI | n^(2(1-b)) | n^(2-b) | 1 | n^(-b) |
aI | n^(2-b) | n^2 | n^b | 1 |
Value
A numeric vector.
Examples
# Values from the power_law() example:
Ai <- 38.6245
slope <- 1.9356
n <- 9
# Usual function call syntax:
a2a(Ai, slope, n, from = "Ai", to = "ai")
# Other syntaxes:
inputs <- list(Ai = Ai, slope = slope, n = n)
a2a(inputs, "ai")
require(magrittr)
inputs %>% a2a("ai")