View source: R/cf_LogRV_MeansRatioW.R
cf_LogRV_MeansRatioW | R Documentation |
N
independent
LOG-TRANSFORMED WEIGHTED MEANS-RATIO random variablescf_LogRV_MeansRatioW(t, n, alpha, weight, coef, niid)
evaluates characteristic function
of a linear combination (resp. convolution) of independent LOG-TRANSFORMED
WEIGHTED MEANS-RATIO random variables (RVs) W_i = log(R_i)
, for i = 1,...,N
,
where each R_i = G_i/A_i
is a ratio of the weighted geometric mean G_i
and the (unweighted) arithmetic mean A_i
of independent RVs X_{i,1},...,X_{i,n_i}
with GAMMA distributions, with the shape parameters \alpha_{i,j}
and the (common) rate parameter
\beta_i
for i = 1,...,N
and j = 1,...,n_i
.
That is, cf_LogRV_MeansRatioW
evaluates the characteristic function of a random
variable Y = coef_1*W_1 +...+ coef_N*W_N
, such that cf_Y(t) = cf_W_1(coef_1*t) *...* cf_W_N(coef_N*t)
,
where cf_W_i(t)
is CF of W_i = log(R_i)
, where R_i
is the ratio statistic of the weighted geometric
mean and the arithmetic mean of independent gamma distributed RVs,
which distribution depends on the shape parameter \alpha_{i,j}
and the vector
of weights w_{i,j}
, for i = 1,...,N
and j = 1,...,n_i
.
Here, for each fixed i = 1,...,N
, the weighted geometric mean is defined
by G_i = (X_{i,1}^w_{i,1} *...* X_{i,n_i}^w_{i,n_i})
, where the weights w_{i,j}
,
j = 1,...,n_i
, are such that w_{i,1} +...+ w_{i,n_i} = 1
, and the arithmetic mean is defined
by A_i = (X_{i,1} +...+ X_{i,n_i})/n_i
.
The random variables X_{i,j}
are mutually independent with X_{i,j} ~ \Gamma(\alpha_{i,j},\beta_i)
for all i = 1,...,N
and j = 1,...,n_i
, where \alpha_{i,j}
are the shape parameters and
\beta_i
is the (common) rate parameter of the gamma distributions.
Note that the weighted ratio random variables R_i
are scale invariant,
so their distribution does not depend on the common rate (or scale) parameter \beta_i
for each i = 1,...,N
.
The distribution of the logarithm of the means ratio log(R_i)
is defined
by its characteristic function, see e.g. Chao and Glaser (JASA 1978), which is
cf_{log(R_i)}(t) = (n_i)^(1i*t) * ... \Gamma(sum(\alpha_{i,j}))/\Gamma(sum(\alpha_{i,j})+1i*t)) * ... Prod_{j=1}^n_i \Gamma(\alpha_{i,j}+1i*w_{i,j}*t)/\Gamma(\alpha_{i,j})
,
for each i = 1,...,N
.
cf_LogRV_MeansRatioW(t, n, alpha, weight, coef, niid)
t |
vector or array of real values, where the CF is evaluated. |
n |
vector of sample size parameters |
alpha |
list of weights vectors with shape parameters |
weight |
list of weights vectors with |
coef |
vector of the coefficients of the linear combination of the
log-transformed random variables. If |
niid |
scalar convolution coeficient |
Characteristic function cf(t)
of a linear combination of N independent
LOG-TRANSFORMED WEIGHTED MEANS-RATIO random variables.
Ver.: 05-Oct-2018 17:54:23 (consistent with Matlab CharFunTool v1.3.0, 17-Jun-2017 17:18:39).
Glaser, R. E. (1976a). The ratio of the geometric mean to the arithmetic mean for a random sample from a gamma distribution. Journal of the American Statistical Association, 71(354), 480-487.
Glaser, R. E. (1976b). Exact critical values for Bartlett's test for homogeneity of variances. Journal of the American Statistical Association, 71(354), 488-490.
Chao, M. T., & Glaser, R. E. (1978). The exact distribution of Bartlett's test statistic for homogeneity of variances with unequal sample sizes. Journal of the American Statistical Association, 73(362), 422-426.
For more details see WIKIPEDIA: https://en.wikipedia.org/wiki/Bartlett
Other Continuous Probability Distribution:
cfS_Arcsine()
,
cfS_Beta()
,
cfS_Gaussian()
,
cfS_Laplace()
,
cfS_Rectangular()
,
cfS_Student()
,
cfS_TSP()
,
cfS_Trapezoidal()
,
cfS_Triangular()
,
cfS_Wigner()
,
cfX_ChiSquare()
,
cfX_Exponential()
,
cfX_FisherSnedecor()
,
cfX_Gamma()
,
cfX_InverseGamma()
,
cfX_LogNormal()
,
cf_ArcsineSymmetric()
,
cf_BetaNC()
,
cf_BetaSymmetric()
,
cf_Beta()
,
cf_ChiSquare()
,
cf_Exponential()
,
cf_FisherSnedecorNC()
,
cf_FisherSnedecor()
,
cf_Gamma()
,
cf_InverseGamma()
,
cf_Laplace()
,
cf_LogRV_BetaNC()
,
cf_LogRV_Beta()
,
cf_LogRV_ChiSquareNC()
,
cf_LogRV_ChiSquare()
,
cf_LogRV_FisherSnedecorNC()
,
cf_LogRV_FisherSnedecor()
,
cf_LogRV_MeansRatio()
,
cf_LogRV_WilksLambdaNC()
,
cf_LogRV_WilksLambda()
,
cf_Normal()
,
cf_RectangularSymmetric()
,
cf_Student()
,
cf_TSPSymmetric()
,
cf_TrapezoidalSymmetric()
,
cf_TriangularSymmetric()
,
cf_vonMises()
## EXAMPLE 1
# CF of log MeansRatio RV with n = 5 and alpha = 7/2
n <- 5
alpha <- 7/2
t <- seq(-100, 100, length.out = 201)
plotReIm(function(t) cf_LogRV_MeansRatioW(t, n, alpha), t,
title = 'CF of log MeansRatio RV with n = 5 and alpha = 7/2')
## EXAMPLE 2
# CF of a weighted linear combination of minus log MeansRatio RVs
rm(list=ls())
n <- c(5, 7, 10)
alpha <- list(c(7/2), c(10/2), c(3/2))
weight = list()
coef <- -1/3
t <- seq(-100, 100, length.out = 201)
plotReIm(function(t) cf_LogRV_MeansRatioW(t, n, alpha, weight, coef), t,
title = 'CF of a weighted linear combination of minus log MeansRatio RVs')
## EXAMPLE 3
# PDF/CDF of minus log MeansRatio RV, n = 5 and alpha = 7/2, from its CF
rm(list=ls())
n <- 5
alpha <- 7/2
coef <- -1
cf <- function(t) cf_LogRV_MeansRatioW(t, n, alpha, coef = coef)
x <- seq(0, 0.6, length.out = 100)
prob <- c(0.9, 0.95, 0.99)
options <- list()
options$xMin <- 0
result <- cf2DistGP(cf, x, prob, options)
str(result)
## EXAMPLE 4
# PDF/CDF of minus log of the (weighted) means ratio RV, from its CF
rm(list=ls())
n <- 5
alpha <- list(c(3, 5, 7, 10, 3) / 2)
weight <- list(alpha[[1]] / sum(alpha[[1]]))
coef <- -1
cf <- function(t) cf_LogRV_MeansRatioW(t, n, alpha, weight, coef)
x <- seq(-0.15, 1.15, length.out = 200)
prob <- c(0.9, 0.95, 0.99)
options <- list()
options$N <- 2^12
result <- cf2DistGP(cf, prob = prob, options = options)
str(result)
## EXAMPLE 5
# Compare the exact distribution with the Bartlett's approximation
rm(list=ls())
k <- 15 # k normal populations with unequal sample sizes
df <- c(1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3) # degrees of freedom
DF <- sum(df)
alpha <- list(df / 2)
weight <- list(alpha[[1]] / sum(alpha[[1]]))
C <- DF * log(k * prod(weight[[1]] ^ weight[[1]]))
C_B <- 1 + 1 / (3 * (k - 1)) * (sum(1 / df) - 1 / DF)
shift <- C / C_B
coef <- -DF / C_B
cf_R <- function(t) cf_LogRV_MeansRatioW(t, k, alpha, weight, coef)
cf <- function(t) exp(1i * t * shift) * cf_R(t)
prob <- c(0.9, 0.95, 0.99)
options <- list()
options$xMin <- 0
options$N <- 2^12
result <- cf2DistGP(cf, prob = prob, options = options)
str(result)
x <- result$x
matplot(cbind(x, x), cbind(result$cdf, pchisq(x, k - 1)),
xlab = 'corrected test statistic', ylab = 'CDF',
main = 'Exact CDF vs. the Bartlett approximation')
matplot(cbind(x, x), cbind(result$cdf, pchisq(x, k - 1)),
xlab = 'corrected test statistic', ylab = 'CDF',
main = 'Exact CDF vs. the Bartlett approximation',
type = "l", lwd = 2)
print(prob)
print(result$qf)
print(qchisq(prob, k - 1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.