estmeansd (version 1.0.1)

qe.fit: 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()
)

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.

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.startnumeric value giving the starting value for the \(\mu\) parameter of the normal distribution.
norm.sigma.startnumeric value giving the starting value for the \(\sigma\) parameter of the normal distribution.
lnorm.mu.startnumeric value giving the starting value for the \(\mu\) parameter of the log-normal distribution.
lnorm.sigma.startnumeric value giving the starting value for the \(\sigma\) parameter of the log-normal distribution.
gamma.shape.startnumeric value giving the starting value for the shape parameter of the gamma distribution.
gamma.rate.startnumeric value giving the starting value for the rate parameter of the gamma distribution.
weibull.shape.startnumeric value giving the starting value for the shape parameter of the Weibull distribution.
weibull.scale.startnumeric value giving the starting value for the scale parameter of the Weibull distribution.
beta.shape1.startnumeric value giving the starting value for the shape1 (i.e., \(\alpha\)) parameter of the beta distribution.
beta.shape2.startnumeric value giving the starting value for the shape2 (i.e., \(\beta\)) parameter of the beta distribution.
norm.mu.boundsvector giving the bounds on the \(\mu\) parameter of the normal distribution.
norm.sigma.boundsvector giving the bounds on the \(\sigma\) parameter of the normal distribution.
lnorm.mu.boundsvector giving the bounds on the \(\mu\) parameter of the the log-normal distribution.
lnorm.sigma.boundsvector giving the bounds on the \(\sigma\) parameter of the log-normal distribution.
gamma.shape.boundsvector giving the bounds on the shape parameter of the gamma distribution.
gamma.rate.boundsvector giving the bounds on the rate parameter of the gamma distribution.
weibull.shape.boundsvector giving the bounds on the shape parameter of the Weibull distribution.
weibull.scale.boundsvector giving the bounds on the scale parameter of the Weibull distribution.
beta.shape1.boundsvector giving the bounds on the shape1 (i.e., \(\alpha\)) parameter of the beta distribution.
beta.shape2.boundsvector giving the bounds on the shape2 (i.e., \(\beta\)) 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.

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

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

Run the code above in your browser using DataLab