qe.fit: Quantile estimation fitting

View source: R/qe.fit.R

qe.fitR Documentation

Quantile estimation fitting

Description

This function fits several parametric families of distributions from summary data in the following forms:

  • S1: median, minimum and maximum values, and sample size

  • S2: median, first and third quartiles, and sample size

  • S3: median, minimum and maximum values, first and third quartiles, and sample size

Usage

qe.fit(
  min.val,
  q1.val,
  med.val,
  q3.val,
  max.val,
  n,
  two.sample.default = FALSE,
  qe.fit.control = list()
)

Arguments

min.val

numeric value giving the sample minimum.

q1.val

numeric value giving the sample first quartile.

med.val

numeric value giving the sample median.

q3.val

numeric value giving the sample third quartile.

max.val

numeric value giving the sample maximum.

n

numeric value giving the sample size.

two.sample.default

logical scalar. If set to TRUE, the candidate distributions, initial values, and box constraints are set to that of McGrath et al. (2020a). If set to FALSE, the candidate distributions, initial values, and box constraints are set to that of McGrath et al. (2020b). The default is FALSE.

qe.fit.control

optional list of control parameters for the minimization algorithm.

norm.mu.start numeric value giving the starting value for the μ parameter of the normal distribution.
norm.sigma.start numeric value giving the starting value for the σ parameter of the normal distribution.
lnorm.mu.start numeric value giving the starting value for the μ parameter of the log-normal distribution.
lnorm.sigma.start numeric value giving the starting value for the σ parameter of the log-normal distribution.
gamma.shape.start numeric value giving the starting value for the shape parameter of the gamma distribution.
gamma.rate.start numeric value giving the starting value for the rate parameter of the gamma distribution.
weibull.shape.start numeric value giving the starting value for the shape parameter of the Weibull distribution.
weibull.scale.start numeric value giving the starting value for the scale parameter of the Weibull distribution.
beta.shape1.start numeric value giving the starting value for the shape1 (i.e., α) parameter of the beta distribution.
beta.shape2.start numeric value giving the starting value for the shape2 (i.e., β) parameter of the beta distribution.
norm.mu.bounds vector giving the bounds on the μ parameter of the normal distribution.
norm.sigma.bounds vector giving the bounds on the σ parameter of the normal distribution.
lnorm.mu.bounds vector giving the bounds on the μ parameter of the the log-normal distribution.
lnorm.sigma.bounds vector giving the bounds on the σ parameter of the log-normal distribution.
gamma.shape.bounds vector giving the bounds on the shape parameter of the gamma distribution.
gamma.rate.bounds vector giving the bounds on the rate parameter of the gamma distribution.
weibull.shape.bounds vector giving the bounds on the shape parameter of the Weibull distribution.
weibull.scale.bounds vector giving the bounds on the scale parameter of the Weibull distribution.
beta.shape1.bounds vector giving the bounds on the shape1 (i.e., α) parameter of the beta distribution.
beta.shape2.bounds vector giving the bounds on the shape2 (i.e., β) parameter of the beta distribution.

Details

Distributions are fit by minimizing the distance between observed and distribution quantiles in the L2-norm. The limited-memory Broyden-Fletcher-Goldfarb-Shanno (L-BFGS-M) algorithm implemented in the optim function is used for minimization.

Two different conventions may be used for setting the candidate distributions, parameter starting values, and parameter constraints, which is controlled by the two.sample.default argument. If the convention of McGrath et al. (2020a) is used, the candidate distributions are the normal, log-normal, gamma, and Weibull distributions. If the convention of McGrath et al. (2020b) is used, the beta distribution is also included. In either case, if a negative value is provided (e.g., for the minimum value or the first quartile value), only the normal distribution is fit.

Value

A object of class qe.fit. The object is a list with the following components:

norm.par

Estimated parameters of the normal distribution.

lnorm.par

Estimated parameters of the log-normal distribution.

gamma.par

Estimated parameters of the gamma distribution.

weibull.par

Estimated parameters of the Weibull distribution.

beta.par

Estimated parameters of the beta distribution.

values

Values of the objective functions evaluated at the estimated paramters of each candidate distribution.

...

Other elements.

The results are printed with the print.qe.fit function. The results can be visualized by using the plot.qe.fit function.

References

McGrath S., Sohn H., Steele R., and Benedetti A. (2020a). Meta-analysis of the difference of medians. Biometrical Journal, 62, 69-98.

McGrath S., Zhao X., Steele R., Thombs B.D., Benedetti A., and the DEPRESsion Screening Data (DEPRESSD) Collaboration. (2020b). Estimating the sample mean and standard deviation from commonly reported quantiles in meta-analysis. Statistical Methods in Medical Research. 29(9):2520-2537.

Examples

## Generate S2 summary data
set.seed(1)
n <- 100
x <- stats::rlnorm(n, 2.5, 1)
quants <- stats::quantile(x, probs = c(0.25, 0.5, 0.75))

## Fit distributions
qe.fit(q1.val = quants[1], med.val = quants[2], q3.val = quants[3], n = n)


estmeansd documentation built on June 19, 2022, 1:05 a.m.