Description Usage Arguments Details Value Author(s) References See Also Examples
Density and distribution functions of the phi statistic, which is the product of two Fisher-Snedecor distributions with particular degrees of freedom.
1 2 3 4 |
x, q |
vector of quantile. |
nu1, nu2, nu |
degrees of freedom (>0, may be
non-integer). |
lower.tail |
logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]. |
tol |
tolerance used for numerical estimation. |
The density distribution of a variable z
that is the product of
two random variables x
and y
with density distributions
f(x) and g(y), respectively, is the integral over the intersection of
the domains of x
and y
of f(x) * g(z/x) / abs(x) dx.
dphi
estimates density values using numerical integration
(integrate
) the Fisher-Scedecor df
density
distribution function. Following the algebra of Multiscale
Codependence Analysis, f(x) has df1 = nu1 and df2 = nu1 * nu2 degrees
of freedom and g(x) has 'df1 = 1' and 'df2 = nu2' degrees of
freedom. Hence, that product distribution has two parameters.
pphi
integrates dphi
in the interval
[0
,q
] when 'lower.tail = TRUE' (the default) and on
the interval [q
,Inf
] when 'lower.tail = FALSE'.
dtau
and ptau
are similar to dphi
integrates
pphi
, but with f(x) and f(y) being two Student's t distribution
with nu
degrees of freedom. It is called by functions
test.cdp
and permute.cdp
to perform
hypothesis tests for single response variables, in which case
unilateral tests can be performed.
dphi
and dtau
return the density functions whereas
pphi
and ptau
return the distribution functions.
Guillaume Guénard, Département des sciences biologiques, Université de Montréal, Montréal, Québec, Canada.
Springer, M. D. 1979. The algebra of random variables. John Wiley and Sons Inc., Hoboken, NJ, USA.
Guénard, G., Legendre, P., Boisclair, D., and Bilodeau, M. 2010. Multiscale codependence analysis: an integrated approach to analyse relationships across scales. Ecology 91: 2952-2964
Guénard, G. Legendre, P. 2018. Bringing multivariate support to multiscale codependence analysis: Assessing the drivers of community structure across spatial scales. Meth. Ecol. Evol. 9: 292-304
test.cdp
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #
### Displays the phi probability distribution for five different numbers
### of degrees of freedom:
#
x <- 10^seq(-4, 0.5, 0.05)
plot(y = dphi(x, 1, 10), x = x, type = "l", col = "black", las = 1, ylab = "pdf",
ylim = c(0, 0.5))
lines(y = dphi(x, 3, 10), x = x, col = "purple")
lines(y = dphi(x, 5, 70), x = x, col = "blue")
lines(y = dphi(x, 12, 23), x = x, col = "green")
lines(y = dphi(x, 35, 140), x = x, col = "red")
#
### Displays the density distribution function for 10 degrees of freedom
### and the cumulative probability above x = 1.
#
x <- 10^seq(-4, 0.5, 0.05)
y <- dphi(x, 5, 70)
plot(y = y, x = x, type = "l", col = "black", las = 1, ylab = "Density",
ylim = c(0, 0.5))
polygon(x = c(x[81L:91], x[length(x)], 1), y = c(y[81L:91], 0, 0),
col = "grey")
text(round(pphi(1, 5, 70, lower.tail=FALSE), 3), x = 1.75, y = 0.05)
#
### Idem for the tau distribution:
#
x <- c(-(10^seq(0.5, -4, -0.05)), 10^seq(-4, 0.5, 0.05))
plot(y = dtau(x, 1), x = x, type = "l", col = "black", las = 1,
ylab = "pdf", ylim = c(0, 0.5))
lines(y = dtau(x, 2), x = x, col = "purple")
lines(y = dtau(x, 5), x = x, col="blue")
lines(y = dtau(x, 10), x = x, col="green")
lines(y = dtau(x, 100), x = x, col="red")
#
y <- dtau(x, 10)
plot(y = y, x = x, type = "l", col = "black", las = 1, ylab = "Density",
ylim = c(0, 0.5))
polygon(x = c(x[which(x==1):length(x)], x[length(x)],1),
y = c(y[which(x==1):length(x)], 0, 0), col = "grey")
text(round(ptau(1, 10, lower.tail = FALSE), 3), x = 1.5, y = 0.03)
polygon(x = c(-1, x[1L], x[1L:which(x==-1)]),
y = c(0, 0, y[1L:which(x==-1)]), col="grey")
text(round(ptau(-1, 10), 3), x = -1.5, y = 0.03)
#
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.