Package 'gaussratiovegind'

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

Help Index


Statistics on Chlorophyll Fluorescence Parameters

Description

Mean and standard deviation values on healthy and diseased tissues of chlorophyll fluorescence parameters F0F_0 (minimum fluorescence) and FmF_m (maximum fluorescence) for a dataset of Arabidopsis thaliana plants infected with fungal pathogen data; parameters of the distribution of the ratio FvFm=FmF0Fm\displaystyle{\frac{F_v}{F_m} = \frac{F_m - F_0}{F_m}}.

Usage

arabidopsis

Format

A data frame with 10 rows and 6 columns:

time

times of the acquisition of chlorophyll fluorescence images

condition

indicates if the plant was inoculated: healthy (inoculated with water) or diseased (inoculated with the pathogen)

mF0, sF0

Mean and standard deviation values of the chlorophyll parameter F0F_0

mFm, sFm

Mean and standard deviation values of the chlorophyll parameter FmF_m

beta, rho, delta

the β\beta, ρ\rho and δy\delta_y parameters of the distribution of FvFm=FmF0Fm\displaystyle{\frac{F_v}{F_m} = \frac{F_m - F_0}{F_m}} (distributed according to a normal ratio distribution, see Details)

Details

On each leaf picture, the F0F_0 and FmF_m values are normally distributed. Hence, F0Fm\displaystyle{\frac{F_0}{F_m}} is a ratio of two normal distributions.

Let μF0\mu_{F_0} and σF0\sigma_{F_0} the mean and standard deviation of F0F_0 and μFm\mu_{F_m} and σFm\sigma_{F_m} the mean and standard deviation of FmF_m. The parameters β\beta, ρ\rho and δy\delta_y are given by:

β=μF0μFm\beta = \frac{\mu_{F_0}}{\mu_{F_m}}

ρ=σFmσF0\rho = \frac{\sigma_{F_m}}{\sigma_{F_0}}

δy=σFmμFm\delta_y = \frac{\sigma_{F_m}}{\mu_{F_m}}

References

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 Function of a Normal Ratio Distribution

Description

Density of the ratio of two Gaussian distributions.

Usage

dnormratio(z, bet, rho, delta, r = 0)

Arguments

z

length pp numeric vector.

bet, rho, delta

numeric values. The parameters (β,ρ,δy)(\beta, \rho, \delta_y) of the distribution, see Details.

r

numeric. The correlation coefficient. Default r=0 (the two distributions are considered independent).

Details

Let two independent random variables XN(μx,σx)X \sim N(\mu_x, \sigma_x) and YN(μy,σy)Y \sim N(\mu_y, \sigma_y).

If we denote β=μxμy\beta = \frac{\mu_x}{\mu_y}, ρ=σyσx\displaystyle{\rho = \frac{\sigma_y}{\sigma_x}} and δy=σyμy\displaystyle{\delta_y = \frac{\sigma_y}{\mu_y}}, the probability distribution function of the ratio Z=XY\displaystyle{Z = \frac{X}{Y}} is given by:

fZ(z;β,ρ,δy)=ρπ(1+ρ2z2)[exp(ρ2β2+12δy2)+π2 q erf(q2)exp(ρ2(zβ)22δy2(1+ρ2z2))]\displaystyle{ f_Z(z; \beta, \rho, \delta_y) = \frac{\rho}{\pi (1 + \rho^2 z^2)} \left[ \exp{\left(-\frac{\rho^2 \beta^2 + 1}{2\delta_y^2}\right)} + \sqrt{\frac{\pi}{2}} \ q \ \text{erf}\left(\frac{q}{\sqrt{2}}\right) \exp\left(-\frac{\rho^2 (z-\beta)^2}{2 \delta_y^2 (1 + \rho^2 z^2)}\right) \right] }

with q=1+βρ2zδy1+ρ2z2\displaystyle{ q = \frac{1 + \beta \rho^2 z}{\delta_y \sqrt{1 + \rho^2 z^2}} } and erf(q2)=2π0q2exp(t2) dt\displaystyle{ \text{erf}\left(\frac{q}{\sqrt{2}}\right) = \frac{2}{\sqrt{\pi}} \int_0^{\frac{q}{\sqrt{2}}}{\exp{(-t^2)}\ dt} }

Another expression of this density, used by the estparnormratio() function, is:

fZ(z;β,ρ,δy)=ρπ(1+ρ2z2) exp(ρ2β2+12δy2) 1F1(1,12;12δy2(1+βρ2z)21+ρ2z2)\displaystyle{ f_Z(z; \beta, \rho, \delta_y) = \frac{\rho}{\pi (1 + \rho^2 z^2)} \ \exp{\left(-\frac{\rho^2 \beta^2 + 1}{2\delta_y^2}\right)} \ {}_1 F_1\left( 1, \frac{1}{2}; \frac{1}{2 \delta_y^2} \frac{(1 + \beta \rho^2 z)^2}{1 + \rho^2 z^2} \right) }

where 1F1(a,b;x)_1 F_1\left(a, b; x\right) is the confluent hypergeometric function (Kummer's function):

1F1(a,b;x)=n=0+(a)n(b)nxnn!\displaystyle{ _1 F_1\left(a, b; x\right) = \sum_{n = 0}^{+\infty}{ \frac{ (a)_n }{ (b)_n } \frac{x^n}{n!} } }

If XX and YY are not independent, let r=Cor(X,Y)=Cov(X,Y)σXσYr = Cor(X, Y) = \frac{Cov(X, Y)}{\sigma_X \sigma_Y}, the probability distribution of Z=XYZ = \frac{X}{Y} is:

fZ(z;β,ρ,δy,r)=ρ1r2π(ρ2z22rρz+1) exp(ρ2β22rβρ+12(1r2)δy2) 1F1(1,12;12(1r2)δy2(βρ2zrρ(z+β)+1)2ρ2z22rρz+1)\displaystyle{ f_Z(z; \beta, \rho, \delta_y, r) = \frac{\rho \sqrt{1 - r^2}}{\pi (\rho^2 z^2 - 2r \rho z +1)} \ \exp{\left(-\frac{\rho^2 \beta^2 - 2r \beta \rho + 1}{2(1 - r^2) \delta_y^2}\right)} \ {}_1 F_1\left( 1, \frac{1}{2}; \frac{1}{2(1 - r^2) \delta_y^2} \frac{(\beta \rho^2 z - r\rho(z + \beta) + 1)^2}{\rho^2 z^2 - 2r \rho z + 1} \right) }

Value

Numeric: the value of density.

Author(s)

Pierre Santagostini, Angélina El Ghaziri, Nizar Bouhlel

References

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

See Also

pnormratio(): probability distribution function.

rnormratio(): sample simulation.

estparnormratio(): parameter estimation.

Examples

# 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 Normal Ratio Distribution

Description

Estimation of the parameters of a ratio Z=XY\displaystyle{Z = \frac{X}{Y}}, XX and YY 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).

Usage

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)

Arguments

z

numeric.

method

the method used to estimate the parameters of the distribution. It can be "EM" (expectation-maximization) or "VB" (Variational Bayes).

indep

logical. If indep=TRUE (default) XX and YY are two independent Gaussian variables and the parameters β\beta, ρ\rho and deltaydelta_y parameters of Z=XYZ=\frac{X}{Y} are estimated. If indep=FALSE, XX and YY can be correlated, and the correlation coefficient rr is also estimated.

eps

numeric. Precision for the estimation of the parameters (see Details).

na.rm

a logical evaluating to TRUE or FALSE indicating whether NA values should be stripped before the computation proceeds.

display

logical. When TRUE the successive values of the parameters are printed.

graph

logical. When TRUE the successive values of the parameters are plotted.

xlim, ylim

if graph is TRUE, the x and y limits of the plot. Default: xlim = c(0, 1000) and ylim depend on the initial values of the parameters: ylim = 10*c(0, max(theta)).

mux0, sigmax0, muy0, sigmay0

initial values of the means and standard deviations of the XX and YY variables. Default: mux0 = 1, sigmax0 = 1, muy0 = 1, sigmay0 = 1.

alphax0, betax0, alphay0, betay0

initial values for the variational Bayes method. Omitted if method="EM". If method="VB", if omitted, they are set to 1.

cov0

initial value of the covariance of XX and YY. If indep is FALSE, cov0 must be different from 0.

Details

Let a random variable: Z=XY\displaystyle{Z = \frac{X}{Y}},

XX and YY being normally distributed: XN(μx,σx)X \sim N(\mu_x, \sigma_x) and YN(μy,σy)Y \sim N(\mu_y, \sigma_y).

The probability density of ZZ is:

fZ(z;β,ρ,δy,r)=ρ1r2π(ρ2z22rρz+1) exp(ρ2β22rβρ+12(1r2)δy2) 1F1(1,12;12(1r2)δy2(βρ2zrρ(z+β)+1)2ρ2z22rρz+1)\displaystyle{ f_Z(z; \beta, \rho, \delta_y, r) = \frac{\rho \sqrt{1 - r^2}}{\pi (\rho^2 z^2 - 2r \rho z +1)} \ \exp{\left(-\frac{\rho^2 \beta^2 - 2r \beta \rho + 1}{2(1 - r^2) \delta_y^2}\right)} \ {}_1 F_1\left( 1, \frac{1}{2}; \frac{1}{2(1 - r^2) \delta_y^2} \frac{(\beta \rho^2 z - r\rho(z + \beta) + 1)^2}{\rho^2 z^2 - 2r \rho z + 1} \right) }

with: β=μxμy\displaystyle{\beta = \frac{\mu_x}{\mu_y}}, ρ=σyσx\displaystyle{\rho = \frac{\sigma_y}{\sigma_x}}, δy=σyμy\displaystyle{\delta_y = \frac{\sigma_y}{\mu_y}}, r=Cor(X,Y)=Cov(X,Y)σXσYr = Cor(X, Y) = \frac{Cov(X, Y)}{\sigma_X \sigma_Y}.

and 1F1(a,b;x)_1 F_1\left(a, b; x\right) is the confluent hypergeometric function (Kummer's function):

1F1(a,b;x)=n=0+(a)n(b)nxnn!\displaystyle{ _1 F_1\left(a, b; x\right) = \sum_{n = 0}^{+\infty}{ \frac{ (a)_n }{ (b)_n } \frac{x^n}{n!} } }

If XX and YY are independent (r=0r = 0), the probability density is:

fZ(z;β,ρ,δy,r=0)=fZ(z;β,ρ,δy)=ρπ(1+ρ2z2) exp(ρ2β2+12δy2) 1F1(1,12;12δy2(1+βρ2z)21+ρ2z2)\displaystyle{ f_Z(z; \beta, \rho, \delta_y, r = 0) = f_Z(z; \beta, \rho, \delta_y) = \frac{\rho}{\pi (1 + \rho^2 z^2)} \ \exp{\left(-\frac{\rho^2 \beta^2 + 1}{2\delta_y^2}\right)} \ {}_1 F_1\left( 1, \frac{1}{2}; \frac{1}{2 \delta_y^2} \frac{(1 + \beta \rho^2 z)^2}{1 + \rho^2 z^2} \right) }

If method = "EM", the means and standard deviations μx\mu_x, σx\sigma_x, μy\mu_y and σy\sigma_y and the correlation coefficient rr are estimated with the EM algorithm.

When r=0r = 0, μx\mu_x, σx\sigma_x, μy\mu_y and σy\sigma_y 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 XX and YY are independent, i.e. r=0r = 0.

Then the parameters β\beta, ρ\rho, δy\delta_y of the ZZ distribution are computed from these means and standard deviations.

The estimation of μx\mu_x, σx\sigma_x, μy\mu_y and σy\sigma_y 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.

Value

A list of 4 elements beta, rho, delta, r: the estimated parameters of the ZZ distribution β^\hat{\beta}, ρ^\hat{\rho}, δ^y\hat{\delta}_y and r^\hat{r}, with three attributes attr(, "epsilon") (precision of the result), attr(, "k") (number of iterations) and attr(, "method") (estimation method).

If indep=FALSE, rr is not estimated, it is set to 0.

Author(s)

Pierre Santagostini, Angélina El Ghaziri, Nizar Bouhlel

References

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

See Also

dnormratio(): probability density of a normal ratio.

rnormratio(): sample simulation.

Examples

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

Confluent DD-Hypergeometric Function

Description

Computes the Kummer's function, or confluent hypergeometric function.

Usage

kummer(a, b, z, eps = 1e-06)

Arguments

a

numeric.

b

numeric

z

numeric vector.

eps

numeric. Precision for the sum (default 1e-06).

Details

The Kummer's confluent hypergeometric function is given by:

1F1(a,b;z)=n=0+(a)n(b)nznn!\displaystyle{_1 F_1\left(a, b; z\right) = \sum_{n = 0}^{+\infty}{ \frac{ (a)_n }{ (b)_n } \frac{z^n}{n!} }}

where (z)p(z)_p 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.

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

Author(s)

Pierre Santagostini, Angélina El Ghaziri, Nizar Bouhlel

References

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


Logarithm of the Pochhammer Symbol

Description

Computes the logarithm of the Pochhammer symbol.

Usage

lnpochhammer(x, n)

Arguments

x

numeric.

n

positive integer.

Details

The Pochhammer symbol is given by:

(x)n=Γ(x+n)Γ(x)=x(x+1)...(x+n1)\displaystyle{ (x)_n = \frac{\Gamma(x+n)}{\Gamma(x)} = x (x+1) ... (x+n-1) }

So, if n>0n > 0:

log((x)n)=log(x)+log(x+1)+...+log(x+n1)\displaystyle{ log\left((x)_n\right) = log(x) + log(x+1) + ... + log(x+n-1) }

If n=0n = 0, log((x)n)=log(1)=0\displaystyle{ log\left((x)_n\right) = log(1) = 0}

Value

Numeric value. The logarithm of the Pochhammer symbol.

Author(s)

Pierre Santagostini, Nizar Bouhlel

See Also

pochhammer, kummer

Examples

lnpochhammer(2, 0)
lnpochhammer(2, 1)
lnpochhammer(2, 3)

Cumulative Distribution of a Normal Ratio Distribution

Description

Cumulative distribution of the ratio of two Gaussian distributions.

Usage

pnormratio(z, bet, rho, delta, r = 0)

Arguments

z

length pp vector of quantiles.

bet, rho, delta

numeric values. The parameters (β,ρ,δy)(\beta, \rho, \delta_y) of the distribution, see Details.

r

numeric. The correlation coefficient. Default r=0 (the two distributions are considered independent).

Details

Let two random variables XN(μx,σx)X \sim N(\mu_x, \sigma_x) and YN(μy,σy)Y \sim N(\mu_y, \sigma_y) with correlation coefficient rr.

If we denote fZ(z;β,ρ,δy,r)\displaystyle{ f_Z(z; \beta, \rho, \delta_y, r)} the probability distribution function of the ratio Z=XY\displaystyle{Z = \frac{X}{Y}}, with β=μxμy\beta = \frac{\mu_x}{\mu_y}, ρ=σyσx\displaystyle{\rho = \frac{\sigma_y}{\sigma_x}}, δy=σyμy\displaystyle{\delta_y = \frac{\sigma_y}{\mu_y}} and r=Cor(X,Y)=Cov(X,Y)σxσy\displaystyle{r = Cor(X, Y) = \frac{Cov(X, Y)}{\sigma_x \sigma_y}} (see dnormratio(), Details section).

The cumulative distribution for ZZ is given by:

F(z;β,ρ,δy)=zfZ(z;β,ρ,δy,r)dz\displaystyle{F(z; \beta, \rho, \delta_y) = \int_{-\infty}^z{f_Z(z; \beta, \rho, \delta_y, r) dz}}

This integral is computed using numerical integration.

Value

Numeric: the value of density.

Author(s)

Pierre Santagostini, Angélina El Ghaziri, Nizar Bouhlel

References

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

See Also

dnormratio(): density function.

rnormratio(): sample simulation.

estparnormratio(): parameter estimation.

Examples

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

Pochhammer Symbol

Description

Computes the Pochhammer symbol.

Usage

pochhammer(x, n)

Arguments

x

numeric.

n

positive integer.

Details

The Pochhammer symbol is given by:

(x)n=Γ(x+n)Γ(x)=x(x+1)...(x+n1)\displaystyle{ (x)_n = \frac{\Gamma(x+n)}{\Gamma(x)} = x (x+1) ... (x+n-1) }

Value

Numeric value. The value of the Pochhammer symbol.

Author(s)

Pierre Santagostini, Nizar Bouhlel

See Also

lnpochhammer, kummer

Examples

pochhammer(2, 0)
pochhammer(2, 1)
pochhammer(2, 3)

Simulate from a Normal Ratio Distribution

Description

Simulate data from a ratio of two Gaussian distributions.

Usage

rnormratio(n, bet, rho, delta, r = 0)

Arguments

n

integer. Number of observations. If length(n) > 1, the length is taken to be the nmber required.

bet, rho, delta

numeric values. The parameters (β,ρ,δy)(\beta, \rho, \delta_y) of the distribution, see Details.

r

numeric. The correlation coefficient. Default r=0 (the two distributions are considered independent).

Details

Let two random variables XN(μx,σx)X \sim N(\mu_x, \sigma_x) and YN(μy,σy)Y \sim N(\mu_y, \sigma_y)

with probability densities fXf_X and fYf_Y.

The parameters of the distribution of the ratio Z=XYZ = \frac{X}{Y} are: β=μxμy\displaystyle{\beta = \frac{\mu_x}{\mu_y}}, ρ=σyσx\displaystyle{\rho = \frac{\sigma_y}{\sigma_x}}, δy=σyμy\displaystyle{\delta_y = \frac{\sigma_y}{\mu_y}} and r=Cor(X,Y)=Cov(X,Y)σxσy\displaystyle{r = Cor(X, Y) = \frac{Cov(X, Y)}{\sigma_x \sigma_y}}.

μx\mu_x, σx\sigma_x, μy\mu_y and σy\sigma_y are computed from β\beta, ρ\rho and δy\delta_y (by fixing arbitrarily μx=1\mu_x = 1).

If XX and YY are independent, i.e. r=0r=0, two random samples (x1,,xn)\left( x_1, \dots, x_n \right) and (y1,,yn)\left( y_1, \dots, y_n \right) are simulated.

If XX and YY are not independent, a sample ((x1,y1),,(xn,yn))\left( (x_1, y_1), \dots, (x_n, y_n) \right) is simpulated using MASS::mvrnorm().

Then (x1y1,,xnyn)\displaystyle{\left( \frac{x_1}{y_1}, \dots, \frac{x_n}{y_n} \right)} is returned.

Value

A numeric vector: the produced sample.

Author(s)

Pierre Santagostini, Angélina El Ghaziri, Nizar Bouhlel

References

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

See Also

dnormratio(): probability density of a normal ratio.

pnormratio(): probability distribution function.

estparnormratio(): parameter estimation.

Examples

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