diff --git a/R/dnormratio.R b/R/dnormratio.R index b5c5aa0736aebdbc6e363f9cf8c91bf38b9dfe12..e477e21111f6df437b20f94bb05aaf43d855cfb3 100644 --- a/R/dnormratio.R +++ b/R/dnormratio.R @@ -1,7 +1,7 @@ dnormratio <- function (z, bet, rho, delta) { #' Ratio of two Gaussian distributions #' - #' Density of the ratio of two Gaussian distributions with strictly positive means and variances. + #' Density of the ratio of two Gaussian distributions<!-- with strictly positive means and variances -->. #' #' @aliases dnormratio #' @@ -9,9 +9,9 @@ dnormratio <- function (z, bet, rho, delta) { #' @param z length \eqn{p} numeric vector. #' @param bet,rho,delta numeric values. The parameters \eqn{(\beta, \rho, \delta)} of the distribution, see Details. #' - #' @details Let two random variables - #' \eqn{X \sim N(\mu_x, \sigma_x)} and \eqn{Y \sim N(\mu_y, \sigma_y)} - #' with \eqn{\mu_x > 0} and \eqn{\mu_y > 0}. + #' @details Let two independant random variables + #' \eqn{X \sim N(\mu_x, \sigma_x)} and \eqn{Y \sim N(\mu_y, \sigma_y)}. + #' <!-- with \eqn{\mu_x > 0} and \eqn{\mu_y > 0}. --> #' #' If we denote \eqn{\beta = \frac{\mu_x}{\mu_y}}, \eqn{\rho = \frac{\sigma_y}{\sigma_x}} and \eqn{\delta_y = \frac{\sigma_y}{\mu_y}}, #' the probability distribution function of the ratio \eqn{Z = \frac{X}{Y}} diff --git a/R/estparnormratio.R b/R/estparnormratio.R index f32ea83768d1f928960c422725be75180cabb56c..bc7d0f7181e3882ad344dc63f5c809688a83a538 100644 --- a/R/estparnormratio.R +++ b/R/estparnormratio.R @@ -1,8 +1,8 @@ estparnormratio <- function(z, eps = 1e-06) { - #' Estimation of the Distribution Parameters of the Ratio of two Gaussian Distributions + #' Estimation of the Parameters of a Normal Ratio Distribution #' - #' Estimation of the parameters of the distribution of a ratio of two distributions - #' \eqn{\displaystyle{Z = \frac{X}{Y}}}, + #' Estimation of the parameters of <!-- the distribution of a ratio of two distributions --> + #' a ratio \eqn{\displaystyle{Z = \frac{X}{Y}}}, #' \eqn{X} and \eqn{Y} being two independant random variables distributed #' according to Gaussian distributions, #' using the EM (estimation-maximization) algorithm. @@ -13,7 +13,7 @@ estparnormratio <- function(z, eps = 1e-06) { #' @param z numeric matrix or data frame. #' @param eps numeric. Precision for the estimation of the parameters. #' @return A list of 3 elements \code{beta}, \code{rho}, \code{delta}: - #' the parameters of the \eqn{Z} distribution: + #' the estimated parameters of the \eqn{Z} distribution #' \eqn{\hat{\beta}}, \eqn{\hat{\rho}}, \eqn{\hat{\delta}_y}, #' with two attributes \code{attr(, "epsilon")} (precision of the result) and \code{attr(, "k")} (number of iterations). #' @@ -24,19 +24,20 @@ estparnormratio <- function(z, eps = 1e-06) { #' #' The density probability of \eqn{Z} is: #' \deqn{\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} \frac{(1 + \beta \rho^2 z)^2}{1 + \rho^2 z^2} \right) + #' 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: \eqn{\displaystyle{\hat{\beta} = \frac{\hat{\mu}_x}{\hat{\mu}_y}}}, - #' \eqn{\displaystyle{\hat{\rho} = \frac{\hat{\sigma}_y}{\hat{\sigma}_x}}}, - #' \eqn{\displaystyle{\hat{\delta}_y = \frac{\hat{\sigma}_y}{\hat{\mu}_y}}}. + #' with: \eqn{\displaystyle{\beta = \frac{\mu_x}{\mu}_y}}, + #' \eqn{\displaystyle{\rho = \frac{\sigma_y}{\sigma_x}}}, + #' \eqn{\displaystyle{\delta_y = \frac{\sigma_y}{\mu_y}}}. #' - #' and \eqn{_1 F_1\left(a, b; x\right)} is the confluent \eqn{D}-hypergeometric function: + #' and \eqn{_1 F_1\left(a, b; x\right)} is the confluent hypergeometric function + #' (Kummer's function): #' \deqn{\displaystyle{ #' _1 F_1\left(a, b; x\right) = \sum_{n = 0}^{+\infty}{ \frac{ (a)_n }{ (b)_n } \frac{x^n}{n!} } #' }} #' - #' The parameters \eqn{\beta}, \eqn{rho}, \eqn{delta_y} of the \eqn{Z} distribution + #' The parameters \eqn{\beta}, \eqn{\rho}, \eqn{\delta_y} of the \eqn{Z} distribution #' are estimated with the EM algorithm, as presented in El Ghaziri et al. #' The computation uses the \code{\link{kummerM}} function. #' @@ -51,7 +52,7 @@ estparnormratio <- function(z, eps = 1e-06) { #' Remote Sensing 15(2), 528 (2023). #' \doi{10.3390/rs15020528} #' - #' @seealso [dnormratio()]: probability density of a Gaussian ratio. + #' @seealso [dnormratio()]: probability density of a normal ratio. #' #' [rnormratio()]: sample simulation. #' diff --git a/R/lnpochhammer.R b/R/lnpochhammer.R index 4311020dad714a980bcd8d2b1a67fba8e1fb11e9..5ad07e5f5501cae724c55135e1c227ab37252412 100644 --- a/R/lnpochhammer.R +++ b/R/lnpochhammer.R @@ -16,7 +16,7 @@ lnpochhammer <- function(x, n) { #' #' If \eqn{n = 0}, \eqn{\displaystyle{ log\left((x)_n\right) = log(1) = 0}} #' @seealso \code{\link{pochhammer}}, - #' \code{\link{lauricella}} + #' \code{\link{kummerM}} #' @author Pierre Santagostini, Nizar Bouhlel #' #' @examples diff --git a/R/pochhammer.R b/R/pochhammer.R index 3b00178e312d0029bfe8bc3fa26f956dfd5cbfc1..5954a80a5de2ebc2d14e3d249c62159f8bdb6596 100644 --- a/R/pochhammer.R +++ b/R/pochhammer.R @@ -11,7 +11,8 @@ pochhammer <- function(x, n) { #' @return Numeric value. The value of the Pochhammer symbol. #' @details The Pochhammer symbol is given by: #' \deqn{ \displaystyle{ (x)_n = \frac{\Gamma(x+n)}{\Gamma(x)} = x (x+1) ... (x+n-1) } } - #' @seealso \code{\link{lauricella}} + #' @seealso \code{\link{lnpochhammer}}, + #' \code{\link{kummerM}} #' @author Pierre Santagostini, Nizar Bouhlel #' #' @examples diff --git a/R/rnormratio.R b/R/rnormratio.R index 76cd792b0dee372f092ab293b6d8a91434a63960..ae6de7198f06b3ef2dbd8262c3ebbf4a1bbde2f2 100644 --- a/R/rnormratio.R +++ b/R/rnormratio.R @@ -1,7 +1,7 @@ rnormratio <- function (n, bet, rho, delta) { #' Ratio of two Gaussian distributions #' - #' Simulate data from a ratio of two Gaussian distributions with strictly positive means and variances. + #' Simulate data from a ratio of two Gaussian distributions<!-- with strictly positive means and variances -->. #' #' @aliases rnormratio #' @@ -11,13 +11,13 @@ rnormratio <- function (n, bet, rho, delta) { #' #' @details Let two random variables #' \eqn{X \sim N(\mu_x, \sigma_x)} and \eqn{Y \sim N(\mu_y, \sigma_y)} - #' (\eqn{\mu_x > 0}, \eqn{\mu_y > 0}) - #' with probability densities \eqn{f_X(\dot)} and \eqn{f_Y(\dot)} + #' <!-- (\eqn{\mu_x > 0}, \eqn{\mu_y > 0}) --> + #' with probability densities \eqn{f_X} and \eqn{f_Y}. #' #' The parameters of the distribution of the ratio \eqn{Z = \frac{X}{Y}} are: - #' \deqn{\displaystyle{\beta = \frac{\mu_x}{\mu_y}}} - #' \deqn{\displaystyle{\rho = \frac{\sigma_y}{\sigma_x}}} - #' \deqn{\displaystyle{\delta_y = \frac{\sigma_y}{\mu_y}}} + #' \eqn{\displaystyle{\beta = \frac{\mu_x}{\mu_y}}}, + #' \eqn{\displaystyle{\rho = \frac{\sigma_y}{\sigma_x}}}, + #' \eqn{\displaystyle{\delta_y = \frac{\sigma_y}{\mu_y}}}. #' #' \eqn{\mu_x}, \eqn{\sigma_x}, \eqn{\mu_y} and \eqn{\sigma_y} are computed from #' \eqn{\beta}, \eqn{\rho} and \eqn{\delta_y} (by fixing arbitrarily \eqn{\mu_x = 1}) @@ -26,7 +26,7 @@ rnormratio <- function (n, bet, rho, delta) { #' #' Then \eqn{\displaystyle{\left( \frac{x_1}{y_1}, \dots, \frac{x_n}{y_n} \right)}} is returned. #' - #' @seealso [dnormratio()]: probability density of a Gaussian ratio. + #' @seealso [dnormratio()]: probability density of a normal ratio. #' #' [estparnormratio()]: parameter estimation. #' diff --git a/man/dnormratio.Rd b/man/dnormratio.Rd index c11f5f15ee61ef724cb3c66551ec7b2f14625144..80ff1ad4e057aef3a75915a8834608979b587235 100644 --- a/man/dnormratio.Rd +++ b/man/dnormratio.Rd @@ -12,12 +12,14 @@ dnormratio(z, bet, rho, delta) \item{bet, rho, delta}{numeric values. The parameters \eqn{(\beta, \rho, \delta)} of the distribution, see Details.} } \description{ -Density of the ratio of two Gaussian distributions with strictly positive means and variances. +Density of the ratio of two Gaussian distributions\if{html}{\out{<!-- with strictly positive means and variances -->}}. } \details{ -Let two random variables -\eqn{X \sim N(\mu_x, \sigma_x)} and \eqn{Y \sim N(\mu_y, \sigma_y)} -with \eqn{\mu_x > 0} and \eqn{\mu_y > 0}. +Let two independant random variables +\eqn{X \sim N(\mu_x, \sigma_x)} and \eqn{Y \sim N(\mu_y, \sigma_y)}.\if{html}{\out{ +<!-- with \eqn{\mu_x > 0} and \eqn{\mu_y > 0}. --> +}} + If we denote \eqn{\beta = \frac{\mu_x}{\mu_y}}, \eqn{\rho = \frac{\sigma_y}{\sigma_x}} and \eqn{\delta_y = \frac{\sigma_y}{\mu_y}}, the probability distribution function of the ratio \eqn{Z = \frac{X}{Y}} diff --git a/man/estparnormratio.Rd b/man/estparnormratio.Rd index 55df272d0df1ec031845a8241eb282e246f52227..1c8046ab0340331770bc6af5d4089a6b372a67a7 100644 --- a/man/estparnormratio.Rd +++ b/man/estparnormratio.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/estparnormratio.R \name{estparnormratio} \alias{estparnormratio} -\title{Estimation of the Distribution Parameters of the Ratio of two Gaussian Distributions} +\title{Estimation of the Parameters of a Normal Ratio Distribution} \usage{ estparnormratio(z, eps = 1e-6) } @@ -13,13 +13,13 @@ estparnormratio(z, eps = 1e-6) } \value{ A list of 3 elements \code{beta}, \code{rho}, \code{delta}: -the parameters of the \eqn{Z} distribution: +the estimated parameters of the \eqn{Z} distribution \eqn{\hat{\beta}}, \eqn{\hat{\rho}}, \eqn{\hat{\delta}_y}, with two attributes \code{attr(, "epsilon")} (precision of the result) and \code{attr(, "k")} (number of iterations). } \description{ -Estimation of the parameters of the distribution of a ratio of two distributions -\eqn{\displaystyle{Z = \frac{X}{Y}}}, +Estimation of the parameters of \if{html}{\out{<!-- the distribution of a ratio of two distributions -->}} +a ratio \eqn{\displaystyle{Z = \frac{X}{Y}}}, \eqn{X} and \eqn{Y} being two independant random variables distributed according to Gaussian distributions, using the EM (estimation-maximization) algorithm. @@ -32,19 +32,20 @@ Let a random variable: \eqn{\displaystyle{Z = \frac{X}{Y}}}, The density probability of \eqn{Z} is: \deqn{\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} \frac{(1 + \beta \rho^2 z)^2}{1 + \rho^2 z^2} \right) +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: \eqn{\displaystyle{\hat{\beta} = \frac{\hat{\mu}_x}{\hat{\mu}_y}}}, -\eqn{\displaystyle{\hat{\rho} = \frac{\hat{\sigma}_y}{\hat{\sigma}_x}}}, -\eqn{\displaystyle{\hat{\delta}_y = \frac{\hat{\sigma}_y}{\hat{\mu}_y}}}. +with: \eqn{\displaystyle{\beta = \frac{\mu_x}{\mu}_y}}, +\eqn{\displaystyle{\rho = \frac{\sigma_y}{\sigma_x}}}, +\eqn{\displaystyle{\delta_y = \frac{\sigma_y}{\mu_y}}}. -and \eqn{_1 F_1\left(a, b; x\right)} is the confluent \eqn{D}-hypergeometric function: +and \eqn{_1 F_1\left(a, b; x\right)} is the confluent hypergeometric function +(Kummer's function): \deqn{\displaystyle{ _1 F_1\left(a, b; x\right) = \sum_{n = 0}^{+\infty}{ \frac{ (a)_n }{ (b)_n } \frac{x^n}{n!} } }} -The parameters \eqn{\beta}, \eqn{rho}, \eqn{delta_y} of the \eqn{Z} distribution +The parameters \eqn{\beta}, \eqn{\rho}, \eqn{\delta_y} of the \eqn{Z} distribution are estimated with the EM algorithm, as presented in El Ghaziri et al. The computation uses the \code{\link{kummerM}} function. @@ -83,7 +84,7 @@ Remote Sensing 15(2), 528 (2023). \doi{10.3390/rs15020528} } \seealso{ -\code{\link[=dnormratio]{dnormratio()}}: probability density of a Gaussian ratio. +\code{\link[=dnormratio]{dnormratio()}}: probability density of a normal ratio. \code{\link[=rnormratio]{rnormratio()}}: sample simulation. } diff --git a/man/lnpochhammer.Rd b/man/lnpochhammer.Rd index 7ca9d21c29bbc912126dab2e474f7bf689d03e2a..ed337cec1e3d77cf58c2aa9533259f081015a76c 100644 --- a/man/lnpochhammer.Rd +++ b/man/lnpochhammer.Rd @@ -33,7 +33,7 @@ lnpochhammer(2, 3) } \seealso{ \code{\link{pochhammer}}, -\code{\link{lauricella}} +\code{\link{kummerM}} } \author{ Pierre Santagostini, Nizar Bouhlel diff --git a/man/pochhammer.Rd b/man/pochhammer.Rd index 1054b4fd55ed9ee69f40daeece846a91c00e5860..5cfa5e657e1224ecc713634a1b6fb4c4b3500b42 100644 --- a/man/pochhammer.Rd +++ b/man/pochhammer.Rd @@ -28,7 +28,8 @@ pochhammer(2, 3) } \seealso{ -\code{\link{lauricella}} +\code{\link{lnpochhammer}}, +\code{\link{kummerM}} } \author{ Pierre Santagostini, Nizar Bouhlel diff --git a/man/rnormratio.Rd b/man/rnormratio.Rd index e9ca2cc15a428996a451d1c298d0c189ef630497..56a80f542ef902059f9a85b3447e56d9686b69ae 100644 --- a/man/rnormratio.Rd +++ b/man/rnormratio.Rd @@ -12,18 +12,21 @@ rnormratio(n, bet, rho, delta) \item{bet, rho, delta}{numeric values. The parameters \eqn{(\beta, \rho, \delta)} of the distribution, see Details.} } \description{ -Simulate data from a ratio of two Gaussian distributions with strictly positive means and variances. +Simulate data from a ratio of two Gaussian distributions\if{html}{\out{<!-- with strictly positive means and variances -->}}. } \details{ Let two random variables -\eqn{X \sim N(\mu_x, \sigma_x)} and \eqn{Y \sim N(\mu_y, \sigma_y)} -(\eqn{\mu_x > 0}, \eqn{\mu_y > 0}) -with probability densities \eqn{f_X(\dot)} and \eqn{f_Y(\dot)} +\eqn{X \sim N(\mu_x, \sigma_x)} and \eqn{Y \sim N(\mu_y, \sigma_y)}\if{html}{\out{ +<!-- (\eqn{\mu_x > 0}, \eqn{\mu_y > 0}) --> +}} + + +with probability densities \eqn{f_X} and \eqn{f_Y}. The parameters of the distribution of the ratio \eqn{Z = \frac{X}{Y}} are: -\deqn{\displaystyle{\beta = \frac{\mu_x}{\mu_y}}} -\deqn{\displaystyle{\rho = \frac{\sigma_y}{\sigma_x}}} -\deqn{\displaystyle{\delta_y = \frac{\sigma_y}{\mu_y}}} +\eqn{\displaystyle{\beta = \frac{\mu_x}{\mu_y}}}, +\eqn{\displaystyle{\rho = \frac{\sigma_y}{\sigma_x}}}, +\eqn{\displaystyle{\delta_y = \frac{\sigma_y}{\mu_y}}}. \eqn{\mu_x}, \eqn{\sigma_x}, \eqn{\mu_y} and \eqn{\sigma_y} are computed from \eqn{\beta}, \eqn{\rho} and \eqn{\delta_y} (by fixing arbitrarily \eqn{\mu_x = 1}) @@ -53,7 +56,7 @@ Remote Sensing 15(2), 528 (2023). \doi{10.3390/rs15020528} } \seealso{ -\code{\link[=dnormratio]{dnormratio()}}: probability density of a Gaussian ratio. +\code{\link[=dnormratio]{dnormratio()}}: probability density of a normal ratio. \code{\link[=estparnormratio]{estparnormratio()}}: parameter estimation. }