qe.fit {estmeansd} | R 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 | ||||||||||||||||||||||||||||||||||||||||
qe.fit.control |
optional list of control parameters for the minimization algorithm.
|
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)