# product-distribution: Frequency Distributions for MCA Parametric Testing In guenardg/codep: Multiscale Codependence Analysis

 product-distribution R Documentation

## Frequency Distributions for MCA Parametric Testing

### Description

Density and distribution functions of the phi statistic, which is the product of two Fisher-Snedecor distributions or the tau statistic, which is the product of two Student's t distributions.

### Usage

dphi(x, nu1, nu2, tol = .Machine\$double.eps^0.5)

pphi(q, nu1, nu2, lower.tail = TRUE, tol = .Machine\$double.eps^0.5)

dtau(x, nu, tol = .Machine\$double.eps^0.5)

ptau(q, nu, lower.tail = TRUE, tol = .Machine\$double.eps^0.5)

### Arguments

 x, q A vector of quantile. nu1, nu2, nu Degrees of freedom (>0, may be non-integer; Inf is allowed. tol The tolerance used during numerical estimation. lower.tail Logical; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x].

### Details

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 f(x) * g(z/x) / abs(x) dx over the intersection of the domains of 'x' and 'y'.

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 and pphi, respectively. pphi integrates dphi, 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.

### Value

dphi and dtau return the density functions, whereas pphi and ptau return the distribution functions.

### Functions

• dphi(): Probability density function for the phi statistics

• pphi(): Distribution function for the phi statistics

• dtau(): Probability density function for the tau statistics

• ptau(): Distribution function for the tau statistics

### Author(s)

Guillaume Guenard and Pierre Legendre, Bertrand Pages Maintainer: Guillaume Guenard <guillaume.guenard@gmail.com>

### References

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

### Examples

### 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.
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)

guenardg/codep documentation built on April 15, 2023, 6:47 a.m.