Learn R Programming

gaussratiovegind (version 3.0.0)

rnormratio: Simulate from a Normal Ratio Distribution

Description

Simulate data from a ratio of two Gaussian distributions.

Usage

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

Value

A numeric vector: the produced sample.

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 \((\beta, \rho, \delta_y)\) of the distribution, see Details.

r

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

Author

Pierre Santagostini, Angélina El Ghaziri, Nizar Bouhlel

Details

Let two random variables \(X \sim N(\mu_x, \sigma_x)\) and \(Y \sim N(\mu_y, \sigma_y)\)

with probability densities \(f_X\) and \(f_Y\).

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

\(\mu_x\), \(\sigma_x\), \(\mu_y\) and \(\sigma_y\) are computed from \(\beta\), \(\rho\) and \(\delta_y\) (by fixing arbitrarily \(\mu_x = 1\)).

If \(X\) and \(Y\) are independent, i.e. \(r=0\), two random samples \(\left( x_1, \dots, x_n \right)\) and \(\left( y_1, \dots, y_n \right)\) are simulated.

If \(X\) and \(Y\) are not independent, a sample \(\left( (x_1, y_1), \dots, (x_n, y_n) \right)\) is simpulated using MASS::mvrnorm().

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

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). tools:::Rd_expr_doi("10.3390/rs15020528")

Marsaglia, G. 2006. Ratios of Normal Variables. Journal of Statistical Software 16. tools:::Rd_expr_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). tools:::Rd_expr_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. tools:::Rd_expr_doi("10.1080/03610920600683689")

See Also

dnormratio(): probability density of a normal ratio.

pnormratio(): probability distribution function.

estparnormratio(): parameter estimation.

Examples

Run this code
# 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)

Run the code above in your browser using DataLab