| Title: | Distribution of Gaussian Ratios |
|---|---|
| Description: | It is well known that the distribution of a Gaussian ratio does not follow a Gaussian distribution. The lack of awareness among users of vegetation indices about this non-Gaussian nature could lead to incorrect statistical modeling and interpretation. This package provides tools to accurately handle and analyse such ratios: density function, parameter estimation, simulation. An example on the study of chlorophyll fluorescence can be found in A. El Ghaziri et al. (2023) <doi:10.3390/rs15020528> and another method for parameter estimation is given in Bouhlel et al. (2023) <doi:10.23919/EUSIPCO58844.2023.10290111>. |
| Authors: | Pierre Santagostini [aut, cre], Nizar Bouhlel [aut], Angélina El Ghaziri [aut], David Rousseau [ctb] |
| Maintainer: | Pierre Santagostini <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 3.0.0 |
| Built: | 2026-05-20 09:07:54 UTC |
| Source: | https://github.com/cran/gaussratiovegind |
Mean and standard deviation values on healthy and diseased tissues
of chlorophyll fluorescence parameters (minimum fluorescence)
and (maximum fluorescence) for a dataset of Arabidopsis thaliana
plants infected with fungal pathogen data;
parameters of the distribution of the ratio
.
arabidopsisarabidopsis
A data frame with 10 rows and 6 columns:
times of the acquisition of chlorophyll fluorescence images
indicates if the plant was inoculated: healthy (inoculated with water) or diseased (inoculated with the pathogen)
Mean and standard deviation values of the chlorophyll parameter
Mean and standard deviation values of the chlorophyll parameter
the , and parameters of the distribution of (distributed according to a normal ratio distribution, see Details)
On each leaf picture, the and values are normally distributed.
Hence, is a ratio of two normal distributions.
Let and the mean and standard deviation of
and and the mean and standard deviation of .
The parameters , and are given by:
El Ghaziri, A., Bouhlel, N., Sapoukhina, N., Rousseau, D., On the importance of non-Gaussianity in chlorophyll fluorescence imaging. Remote Sensing 15(2), 528 (2023). doi:10.3390/rs15020528
Pavicic, M., Overmyer, K., Rehman, A.u., Jones, P., Jacobson, D., Himanen, K. Image-Based Methods to Score Fungal Pathogen Symptom Progression and Severity in Excised Arabidopsis Leaves. Plants, 10, 158 (2021). doi:10.3390/plants10010158
Density of the ratio of two Gaussian distributions.
dnormratio(z, bet, rho, delta, r = 0)dnormratio(z, bet, rho, delta, r = 0)
z |
length |
bet, rho, delta
|
numeric values. The parameters |
r |
numeric. The correlation coefficient. Default |
Let two independent random variables
and .
If we denote ,
and ,
the probability distribution function of the ratio
is given by:
with
and
Another expression of this density, used by the estparnormratio() function, is:
where is the confluent hypergeometric function
(Kummer's function):
If and are not independent,
let ,
the probability distribution of is:
Numeric: the value of density.
Pierre Santagostini, Angélina El Ghaziri, Nizar Bouhlel
El Ghaziri, A., Bouhlel, N., Sapoukhina, N., Rousseau, D., On the importance of non-Gaussianity in chlorophyll fluorescence imaging. Remote Sensing 15(2), 528 (2023). doi:10.3390/rs15020528
Marsaglia, G. 2006. Ratios of Normal Variables. Journal of Statistical Software 16. doi:10.18637/jss.v016.i04
Díaz-Francés, E., Rubio, F.J., On the existence of a normal approximation to the distribution of the ratio of two independent normal random variables. Stat Papers 54, 309–323 (2013). doi:10.1007/s00362-012-0429-2
Pham-Gia, T., Turkkan, N., Marchand, E. (2006) Density of the Ratio of Two Normal Random Variables and Applications, Communications in Statistics - Theory and Methods, 35:9, 1569-1591. doi:10.1080/03610920600683689
pnormratio(): probability distribution function.
rnormratio(): sample simulation.
estparnormratio(): parameter estimation.
# First example: ratio of independent variables beta1 <- 0.15 rho1 <- 5.75 delta1 <- 0.22 dnormratio(0, bet = beta1, rho = rho1, delta = delta1) dnormratio(0.5, bet = beta1, rho = rho1, delta = delta1) curve(dnormratio(x, bet = beta1, rho = rho1, delta = delta1), from = -0.1, to = 0.7) # Second example: ratio of correlated variables beta2 <- 2 rho2 <- 2 delta2 <- 2 r2 <- 0.8 dnormratio(0, bet = beta2, rho = rho2, delta = delta2, r = r2) dnormratio(1, bet = beta2, rho = rho2, delta = delta2, r = r2) curve(dnormratio(x, bet = beta2, rho = rho2, delta = delta2, r = r2), from = -1.5, to = 2.5)# First example: ratio of independent variables beta1 <- 0.15 rho1 <- 5.75 delta1 <- 0.22 dnormratio(0, bet = beta1, rho = rho1, delta = delta1) dnormratio(0.5, bet = beta1, rho = rho1, delta = delta1) curve(dnormratio(x, bet = beta1, rho = rho1, delta = delta1), from = -0.1, to = 0.7) # Second example: ratio of correlated variables beta2 <- 2 rho2 <- 2 delta2 <- 2 r2 <- 0.8 dnormratio(0, bet = beta2, rho = rho2, delta = delta2, r = r2) dnormratio(1, bet = beta2, rho = rho2, delta = delta2, r = r2) curve(dnormratio(x, bet = beta2, rho = rho2, delta = delta2, r = r2), from = -1.5, to = 2.5)
Estimation of the parameters of a ratio ,
and being two random variables distributed
according to Gaussian distributions,
using the EM (estimation-maximization) algorithm or variational inference.
Depending on the estimation method, the estparnormatio function calls
estparEM (EM algorithm) or estparVB (variational Bayes).
estparnormratio(z, method = c("EM", "VB"), indep = TRUE, eps = 1e-06, na.rm = FALSE, display = FALSE, graph = FALSE, xlim = NULL, ylim = NULL, mux0 = 1, sigmax0 = 1, alphax0 = NULL, betax0 = NULL, muy0 = 1, sigmay0 = 1, alphay0 = NULL, betay0 = NULL, cov0 = 0) estparEM(z, indep = TRUE, eps = 1e-06, na.rm = FALSE, display = FALSE, graph = FALSE, xlim = NULL, ylim = NULL, mux0 = 1, sigmax0 = 1, muy0 = 1, sigmay0 = 1, cov0 = 0) estparVB(z, eps = 1e-06, na.rm = FALSE, display = FALSE, graph = FALSE, xlim = NULL, ylim = NULL, mux0 = 1, sigmax0 = 1, alphax0 = 1, betax0 = 1, muy0 = 1, sigmay0 = 1, alphay0 = 1, betay0 = 1)estparnormratio(z, method = c("EM", "VB"), indep = TRUE, eps = 1e-06, na.rm = FALSE, display = FALSE, graph = FALSE, xlim = NULL, ylim = NULL, mux0 = 1, sigmax0 = 1, alphax0 = NULL, betax0 = NULL, muy0 = 1, sigmay0 = 1, alphay0 = NULL, betay0 = NULL, cov0 = 0) estparEM(z, indep = TRUE, eps = 1e-06, na.rm = FALSE, display = FALSE, graph = FALSE, xlim = NULL, ylim = NULL, mux0 = 1, sigmax0 = 1, muy0 = 1, sigmay0 = 1, cov0 = 0) estparVB(z, eps = 1e-06, na.rm = FALSE, display = FALSE, graph = FALSE, xlim = NULL, ylim = NULL, mux0 = 1, sigmax0 = 1, alphax0 = 1, betax0 = 1, muy0 = 1, sigmay0 = 1, alphay0 = 1, betay0 = 1)
z |
numeric. |
method |
the method used to estimate the parameters of the distribution.
It can be |
indep |
logical. If |
eps |
numeric. Precision for the estimation of the parameters (see Details). |
na.rm |
a logical evaluating to |
display |
logical. When |
graph |
logical. When |
xlim, ylim
|
if |
mux0, sigmax0, muy0, sigmay0
|
initial values of the means and
standard deviations of the |
alphax0, betax0, alphay0, betay0
|
initial values for the variational
Bayes method. Omitted if |
cov0 |
initial value of the covariance of |
Let a random variable: ,
and being normally distributed:
and .
The probability density of is:
with: ,
,
,
.
and is the confluent hypergeometric function
(Kummer's function):
If and are independent (),
the probability density is:
If method = "EM", the means and standard deviations
, , and
and the correlation coefficient
are estimated with the EM algorithm.
When , , , and
are estimated using the algorithm presented in El Ghaziri et al.
If method = "VB", they are estimated with the variational Bayes method
as presented in Bouhlel et al. For now, this method is available only
for the case when and are independent, i.e. .
Then the parameters , , of the distribution
are computed from these means and standard deviations.
The estimation of , , and
uses an iterative algorithm.
The precision for their estimation is given by the eps parameter.
The computation uses the kummer function.
If there are ties in the z vector, it generates a warning,
as there should be no ties in data distributed among a continuous distribution.
A list of 4 elements beta, rho, delta, r:
the estimated parameters of the distribution
, , and ,
with three attributes attr(, "epsilon") (precision of the result),
attr(, "k") (number of iterations) and attr(, "method")
(estimation method).
If indep=FALSE, is not estimated, it is set to 0.
Pierre Santagostini, Angélina El Ghaziri, Nizar Bouhlel
El Ghaziri, A., Bouhlel, N., Sapoukhina, N., Rousseau, D., On the importance of non-Gaussianity in chlorophyll fluorescence imaging. Remote Sensing 15(2), 528 (2023). doi:10.3390/rs15020528
Bouhlel, N., Mercier, F., El Ghaziri, A., Rousseau, D., Parameter Estimation of the Normal Ratio Distribution with Variational Inference. 2023 31st European Signal Processing Conference (EUSIPCO), Helsinki, Finland, 2023, pp. 1823-1827. doi:10.23919/EUSIPCO58844.2023.10290111
dnormratio(): probability density of a normal ratio.
rnormratio(): sample simulation.
# First example: ratio of independent variables beta1 <- 0.15 rho1 <- 5.75 delta1 <- 0.22 set.seed(1234) z1 <- rnormratio(800, bet = beta1, rho = rho1, delta = delta1) # With the EM method: estparnormratio(z1, method = "EM", indep = TRUE) # With the variational method: estparnormratio(z1, method = "VB") # Second example: ratio of correlated variables beta2 <- 0.24 rho2 <- 4.21 delta2 <- 0.25 r2 <- 0.8 set.seed(1234) z2 <- rnormratio(800, bet = beta2, rho = rho2, r = r2, delta = delta2) # With the EM method: estparnormratio(z2, method = "EM", indep = FALSE)# First example: ratio of independent variables beta1 <- 0.15 rho1 <- 5.75 delta1 <- 0.22 set.seed(1234) z1 <- rnormratio(800, bet = beta1, rho = rho1, delta = delta1) # With the EM method: estparnormratio(z1, method = "EM", indep = TRUE) # With the variational method: estparnormratio(z1, method = "VB") # Second example: ratio of correlated variables beta2 <- 0.24 rho2 <- 4.21 delta2 <- 0.25 r2 <- 0.8 set.seed(1234) z2 <- rnormratio(800, bet = beta2, rho = rho2, r = r2, delta = delta2) # With the EM method: estparnormratio(z2, method = "EM", indep = FALSE)
-Hypergeometric FunctionComputes the Kummer's function, or confluent hypergeometric function.
kummer(a, b, z, eps = 1e-06)kummer(a, b, z, eps = 1e-06)
a |
numeric. |
b |
numeric |
z |
numeric vector. |
eps |
numeric. Precision for the sum (default 1e-06). |
The Kummer's confluent hypergeometric function is given by:
where is the Pochhammer symbol (see pochhammer).
The eps argument gives the required precision for its computation.
It is the attr(, "epsilon") attribute of the returned value.
A numeric value: the value of the Kummer's function,
with two attributes attr(, "epsilon") (precision of the result) and attr(, "k") (number of iterations).
Pierre Santagostini, Angélina El Ghaziri, Nizar Bouhlel
El Ghaziri, A., Bouhlel, N., Sapoukhina, N., Rousseau, D., On the importance of non-Gaussianity in chlorophyll fluorescence imaging. Remote Sensing 15(2), 528 (2023). doi:10.3390/rs15020528
Computes the logarithm of the Pochhammer symbol.
lnpochhammer(x, n)lnpochhammer(x, n)
x |
numeric. |
n |
positive integer. |
The Pochhammer symbol is given by:
So, if :
If ,
Numeric value. The logarithm of the Pochhammer symbol.
Pierre Santagostini, Nizar Bouhlel
lnpochhammer(2, 0) lnpochhammer(2, 1) lnpochhammer(2, 3)lnpochhammer(2, 0) lnpochhammer(2, 1) lnpochhammer(2, 3)
Cumulative distribution of the ratio of two Gaussian distributions.
pnormratio(z, bet, rho, delta, r = 0)pnormratio(z, bet, rho, delta, r = 0)
z |
length |
bet, rho, delta
|
numeric values. The parameters |
r |
numeric. The correlation coefficient. Default |
Let two random variables
and
with correlation coefficient .
If we denote
the probability distribution function of the ratio
,
with ,
,
and
(see dnormratio(), Details section).
The cumulative distribution for is given by:
This integral is computed using numerical integration.
Numeric: the value of density.
Pierre Santagostini, Angélina El Ghaziri, Nizar Bouhlel
El Ghaziri, A., Bouhlel, N., Sapoukhina, N., Rousseau, D., On the importance of non-Gaussianity in chlorophyll fluorescence imaging. Remote Sensing 15(2), 528 (2023). doi:10.3390/rs15020528
Marsaglia, G. 2006. Ratios of Normal Variables. Journal of Statistical Software 16. doi:10.18637/jss.v016.i04
Díaz-Francés, E., Rubio, F.J., On the existence of a normal approximation to the distribution of the ratio of two independent normal random variables. Stat Papers 54, 309–323 (2013). doi:10.1007/s00362-012-0429-2
dnormratio(): density function.
rnormratio(): sample simulation.
estparnormratio(): parameter estimation.
# First example: ratio of independent variables beta1 <- 0.15 rho1 <- 5.75 delta1 <- 0.22 pnormratio(0, bet = beta1, rho = rho1, delta = delta1) pnormratio(0.5, bet = beta1, rho = rho1, delta = delta1) curve(pnormratio(x, bet = beta1, rho = rho1, delta = delta1), from = -0.1, to = 0.7) # Second example: ratio of correlated variables beta2 <- 2 rho2 <- 2 delta2 <- 2 r2 <- 0.8 pnormratio(0, bet = beta2, rho = rho2, delta = delta2, r = r2) pnormratio(1, bet = beta2, rho = rho2, delta = delta2, r = r2) curve(pnormratio(x, bet = beta2, rho = rho2, delta = delta2, r = r2), from = -1.5, to = 2.5)# First example: ratio of independent variables beta1 <- 0.15 rho1 <- 5.75 delta1 <- 0.22 pnormratio(0, bet = beta1, rho = rho1, delta = delta1) pnormratio(0.5, bet = beta1, rho = rho1, delta = delta1) curve(pnormratio(x, bet = beta1, rho = rho1, delta = delta1), from = -0.1, to = 0.7) # Second example: ratio of correlated variables beta2 <- 2 rho2 <- 2 delta2 <- 2 r2 <- 0.8 pnormratio(0, bet = beta2, rho = rho2, delta = delta2, r = r2) pnormratio(1, bet = beta2, rho = rho2, delta = delta2, r = r2) curve(pnormratio(x, bet = beta2, rho = rho2, delta = delta2, r = r2), from = -1.5, to = 2.5)
Computes the Pochhammer symbol.
pochhammer(x, n)pochhammer(x, n)
x |
numeric. |
n |
positive integer. |
The Pochhammer symbol is given by:
Numeric value. The value of the Pochhammer symbol.
Pierre Santagostini, Nizar Bouhlel
pochhammer(2, 0) pochhammer(2, 1) pochhammer(2, 3)pochhammer(2, 0) pochhammer(2, 1) pochhammer(2, 3)
Simulate data from a ratio of two Gaussian distributions.
rnormratio(n, bet, rho, delta, r = 0)rnormratio(n, bet, rho, delta, r = 0)
n |
integer. Number of observations. If |
bet, rho, delta
|
numeric values. The parameters |
r |
numeric. The correlation coefficient. Default |
Let two random variables
and
with probability densities and .
The parameters of the distribution of the ratio are:
,
,
and .
, , and are computed from
, and (by fixing arbitrarily ).
If and are independent, i.e. , two random samples
and
are simulated.
If and are not independent,
a sample
is simpulated using MASS::mvrnorm().
Then is returned.
A numeric vector: the produced sample.
Pierre Santagostini, Angélina El Ghaziri, Nizar Bouhlel
El Ghaziri, A., Bouhlel, N., Sapoukhina, N., Rousseau, D., On the importance of non-Gaussianity in chlorophyll fluorescence imaging. Remote Sensing 15(2), 528 (2023). doi:10.3390/rs15020528
Marsaglia, G. 2006. Ratios of Normal Variables. Journal of Statistical Software 16. doi:10.18637/jss.v016.i04
Díaz-Francés, E., Rubio, F.J., On the existence of a normal approximation to the distribution of the ratio of two independent normal random variables. Stat Papers 54, 309–323 (2013). doi:10.1007/s00362-012-0429-2
Pham-Gia, T., Turkkan, N., Marchand, E. (2006) Density of the Ratio of Two Normal Random Variables and Applications, Communications in Statistics - Theory and Methods, 35:9, 1569-1591. doi:10.1080/03610920600683689
dnormratio(): probability density of a normal ratio.
pnormratio(): probability distribution function.
estparnormratio(): parameter estimation.
# First example: ratio of independent variables beta1 <- 0.15 rho1 <- 5.75 delta1 <- 0.22 rnormratio(20, bet = beta1, rho = rho1, delta = delta1) # Second example: ratio of correlated variables beta2 <- 0.24 rho2 <- 4.21 delta2 <- 0.25 r2 <- 0.8 rnormratio(20, bet = beta2, rho = rho2, delta = delta2, r = r2)# First example: ratio of independent variables beta1 <- 0.15 rho1 <- 5.75 delta1 <- 0.22 rnormratio(20, bet = beta1, rho = rho1, delta = delta1) # Second example: ratio of correlated variables beta2 <- 0.24 rho2 <- 4.21 delta2 <- 0.25 r2 <- 0.8 rnormratio(20, bet = beta2, rho = rho2, delta = delta2, r = r2)