Title: | Estimating the Sample Mean and Standard Deviation from Commonly Reported Quantiles in Meta-Analysis |
---|---|
Description: | Implements the methods of McGrath et al. (2020) <doi:10.1177/0962280219889080> and Cai et al. (2021) <doi:10.1177/09622802211047348> for estimating the sample mean and standard deviation from commonly reported quantiles in meta-analysis. These methods can be applied to studies that report the sample median, sample size, and one or both of (i) the sample minimum and maximum values and (ii) the first and third quartiles. The corresponding standard error estimators described by McGrath et al. (2023) <doi:10.1177/09622802221139233> are also included. |
Authors: | Sean McGrath [aut, cre] , XiaoFei Zhao [aut], Russell Steele [aut], Andrea Benedetti [aut] |
Maintainer: | Sean McGrath <[email protected]> |
License: | GPL (>=3) |
Version: | 1.0.1 |
Built: | 2024-11-13 05:28:57 UTC |
Source: | https://github.com/stmcg/estmeansd |
This function applies the Box-Cox (BC) method to estimate the sample mean and standard deviation from a study that presents one of the following sets of summary statistics:
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
bc.mean.sd( min.val, q1.val, med.val, q3.val, max.val, n, preserve.tail = FALSE, avoid.mc = FALSE )
bc.mean.sd( min.val, q1.val, med.val, q3.val, max.val, n, preserve.tail = FALSE, avoid.mc = FALSE )
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. |
preserve.tail |
logical scalar indicating whether to preserve or remove (if applicable) the negative-domain left suppport (and the corresponding right support to maintain the symmetry of the underlying normal distribution) of the Box-Cox cumulative distribution function. The classical Box-Cox transformation only takes positive numbers as input, so this parameter has a default value of |
avoid.mc |
logical scalar indicating whether to avoid Monte Carlo simulation (if possible) when performing the inverse Box-Cox transformation (the default is |
The BC method incorporates the Box-Cox power transformation into the sample mean estimators of Luo et al. (2016) and the sample standard deviation estimators of Wan et al. (2014) so that their assumption of normality is more tenable. The BC method consists of the following steps, outlined below.
First, an optimal value of the power parameter is found so that the distribution of the Box-Cox transformed data is approximately normal. Then, the methods of Luo et al. and Wan et al. are applied to estimate the mean and standard deviation of the distribution of the transformed data. Finally, the inverse transformation is applied to estimate the sample mean and standard deviation of the original, untransformed data.
To perform the inverse transformation, either numerical integration or Monte Carlo simulation can be applied, which is controlled by the avoid.mc
argument. When the estimated mean of the Box-Cox transformed data is negative or close to zero (i.e., below 0.01), numerical integration often does not converge. Therefore, Monte Carlo simulation is automatically used in this case.
A object of class bc.mean.sd
. The object is a list with the following components:
est.mean |
Estimated sample mean. |
est.sd |
Estimated sample standard deviation. |
location |
Estimated mean of the Box-Cox transformed data. |
scale |
Estimated standard deviation of the Box-Cox transformed data. |
shape |
Estimated transformation parameter |
bc.norm.rvs |
The random variables generated by the Box-Cox (or, equivalently, power-normal) distribution during the Monte Carlo simulation. If Monte Carlo simulation is not used, a value of |
... |
Some additional elements. |
The results are printed with the print.bc.mean.sd
function.
McGrath S., Zhao X., Steele R., Thombs B.D., Benedetti A., and the DEPRESsion Screening Data (DEPRESSD) Collaboration. (2020). Estimating the sample mean and standard deviation from commonly reported quantiles in meta-analysis. Statistical Methods in Medical Research. 29(9):2520-2537.
Box G.E.P., and D.R. Cox. (1964). An analysis of transformations. Journal of the Royal Statistical Society Series B. 26(2):211-52.
Luo D., Wan X., Liu J., and Tong T. (2016). Optimally estimating the sample mean from the sample size, median, mid-range, and/or mid-quartile range. Statistical Methods in Medical Research. 27(6):1785-805
Wan X., Wang W., Liu J., and Tong T. (2014). Estimating the sample mean and standard deviation from the sample size, median, range and/or interquartile range. BMC Medical Research Methodology. 14:135.
## 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)) obs.mean <- mean(x) obs.sd <- stats::sd(x) ## Estimate the sample mean and standard deviation using the BC method bc.mean.sd(q1.val = quants[1], med.val = quants[2], q3.val = quants[3], n = n)
## 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)) obs.mean <- mean(x) obs.sd <- stats::sd(x) ## Estimate the sample mean and standard deviation using the BC method bc.mean.sd(q1.val = quants[1], med.val = quants[2], q3.val = quants[3], n = n)
A generic function for computing parametric bootstrap standard error (SE) estimates.
get_SE(x, ...)
get_SE(x, ...)
x |
an object for which a standard error estimate is desired |
... |
other arguments. |
A list with the following components:
est.se |
Estimated standard error of the mean estimator. |
boot.means |
Bootstrap replicates of the mean estimates. |
boot.sds |
Bootstrap replicates of the standard deviation estimates. |
McGrath S., Katzenschlager S., Zimmer A.J., Seitel A., Steele R., and Benedetti A. (2023). Standard error estimation in meta-analysis of studies reporting medians. Statistical Methods in Medical Research. 32(2):373-388.
Computes a parametric bootstrap standard error estimate for the box-cox approach.
## S3 method for class 'bc.mean.sd' get_SE(x, nboot = 1000, shift.when.negative = TRUE, shift.val = 0.5, ...)
## S3 method for class 'bc.mean.sd' get_SE(x, nboot = 1000, shift.when.negative = TRUE, shift.val = 0.5, ...)
x |
object of class "bc.mean.sd". |
nboot |
numeric value giving the number of bootstrap replicates. The default is |
shift.when.negative |
logical scalar indicating whether to add a constant to the generated sample quantiles if the smallest quantile (i.e., the minimum value in scenarios S1 and S3, the first quartile in scenario S2) is negative. When this argument is set to |
shift.val |
numeric value to which the smallest quantile should be shifted to if it is negative (see argument |
... |
other arguments. |
A list with the following components:
est.se |
Estimated standard error of the mean estimator. |
boot.means |
Bootstrap replicates of the mean estimates. |
boot.sds |
Bootstrap replicates of the standard deviation estimates. |
McGrath S., Katzenschlager S., Zimmer A.J., Seitel A., Steele R., and Benedetti A. (2023). Standard error estimation in meta-analysis of studies reporting medians. Statistical Methods in Medical Research. 32(2):373-388.
McGrath S., Zhao X., Steele R., Thombs B.D., Benedetti A., and the DEPRESsion Screening Data (DEPRESSD) Collaboration. (2020). Estimating the sample mean and standard deviation from commonly reported quantiles in meta-analysis. Statistical Methods in Medical Research. 29(9):2520-2537.
## Generate S2 summary data set.seed(1) n <- 250 x <- stats::rlnorm(n, 5, 0.25) quants <- stats::quantile(x, probs = c(0, 0.5, 1)) ## Estimate the mean and its standard error res <- bc.mean.sd(min.val = quants[1], med.val = quants[2], max.val = quants[3], n = n) get_SE(res)$est.se
## Generate S2 summary data set.seed(1) n <- 250 x <- stats::rlnorm(n, 5, 0.25) quants <- stats::quantile(x, probs = c(0, 0.5, 1)) ## Estimate the mean and its standard error res <- bc.mean.sd(min.val = quants[1], med.val = quants[2], max.val = quants[3], n = n) get_SE(res)$est.se
Computes a parametric bootstrap standard error estimate for the method for unknown non-normal distributions approach.
## S3 method for class 'mln.mean.sd' get_SE(x, nboot = 1000, shift.when.negative = TRUE, shift.val = 0.5, ...)
## S3 method for class 'mln.mean.sd' get_SE(x, nboot = 1000, shift.when.negative = TRUE, shift.val = 0.5, ...)
x |
object of class "mln.mean.sd". |
nboot |
numeric value giving the number of bootstrap replicates. The default is |
shift.when.negative |
logical scalar indicating whether to add a constant to the generated sample quantiles if the smallest quantile (i.e., the minimum value in scenarios S1 and S3, the first quartile in scenario S2) is negative. When this argument is set to |
shift.val |
numeric value to which the smallest quantile should be shifted to if it is negative (see argument |
... |
other arguments. |
A list with the following components:
est.se |
Estimated standard error of the mean estimator. |
boot.means |
Bootstrap replicates of the mean estimates. |
boot.sds |
Bootstrap replicates of the standard deviation estimates. |
McGrath S., Katzenschlager S., Zimmer A.J., Seitel A., Steele R., and Benedetti A. (2023). Standard error estimation in meta-analysis of studies reporting medians. Statistical Methods in Medical Research. 32(2):373-388.
Cai S., Zhou J., and Pan J. (2021). Estimating the sample mean and standard deviation from order statistics and sample size in meta-analysis. Statistical Methods in Medical Research. 30(12):2701-2719.
## Generate S2 summary data set.seed(1) n <- 250 x <- stats::rlnorm(n, 5, 0.25) quants <- stats::quantile(x, probs = c(0, 0.5, 1)) ## Estimate the mean and its standard error res <- mln.mean.sd(min.val = quants[1], med.val = quants[2], max.val = quants[3], n = n) get_SE(res)$est.se
## Generate S2 summary data set.seed(1) n <- 250 x <- stats::rlnorm(n, 5, 0.25) quants <- stats::quantile(x, probs = c(0, 0.5, 1)) ## Estimate the mean and its standard error res <- mln.mean.sd(min.val = quants[1], med.val = quants[2], max.val = quants[3], n = n) get_SE(res)$est.se
Computes a parametric bootstrap standard error estimate for the quantile estimation approach.
## S3 method for class 'qe.mean.sd' get_SE(x, nboot = 1000, shift.when.negative = TRUE, shift.val = 0.5, ...)
## S3 method for class 'qe.mean.sd' get_SE(x, nboot = 1000, shift.when.negative = TRUE, shift.val = 0.5, ...)
x |
object of class "qe.mean.sd". |
nboot |
numeric value giving the number of bootstrap replicates. The default is |
shift.when.negative |
logical scalar indicating whether to add a constant to the generated sample quantiles if the smallest quantile (i.e., the minimum value in scenarios S1 and S3, the first quartile in scenario S2) is negative. When this argument is set to |
shift.val |
numeric value to which the smallest quantile should be shifted to if it is negative (see argument |
... |
other arguments. |
A list with the following components:
est.se |
Estimated standard error of the mean estimator. |
boot.means |
Bootstrap replicates of the mean estimates. |
boot.sds |
Bootstrap replicates of the standard deviation estimates. |
McGrath S., Katzenschlager S., Zimmer A.J., Seitel A., Steele R., and Benedetti A. (2023). Standard error estimation in meta-analysis of studies reporting medians. Statistical Methods in Medical Research. 32(2):373-388.
McGrath S., Zhao X., Steele R., Thombs B.D., Benedetti A., and the DEPRESsion Screening Data (DEPRESSD) Collaboration. (2020). Estimating the sample mean and standard deviation from commonly reported quantiles in meta-analysis. Statistical Methods in Medical Research. 29(9):2520-2537.
## Generate S2 summary data set.seed(1) n <- 250 x <- stats::rlnorm(n, 5, 0.25) quants <- stats::quantile(x, probs = c(0, 0.5, 1)) ## Estimate the mean and its standard error res <- qe.mean.sd(min.val = quants[1], med.val = quants[2], max.val = quants[3], n = n) get_SE(res)$est.se
## Generate S2 summary data set.seed(1) n <- 250 x <- stats::rlnorm(n, 5, 0.25) quants <- stats::quantile(x, probs = c(0, 0.5, 1)) ## Estimate the mean and its standard error res <- qe.mean.sd(min.val = quants[1], med.val = quants[2], max.val = quants[3], n = n) get_SE(res)$est.se
This function applies the Method for Unknown Non-Normal Distributions (MLN) approach to estimate the sample mean and standard deviation from a study that presents one of the following sets of summary statistics:
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
mln.mean.sd(min.val, q1.val, med.val, q3.val, max.val, n)
mln.mean.sd(min.val, q1.val, med.val, q3.val, max.val, n)
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. |
Like the Box-Cox method of McGrath et al. (2020), the MLN method of Cai et al. (2021) assumes that the underlying distribution is normal after applying a suitable Box-Cox transformation with power parameter . Specifically, the MLN method consists of the following steps, outlined below.
First, a maximum likelihood approach is used to estimate the power parameter , where the methods of Luo et al. (2016) and Wan et al. (2014) are applied to estimate the mean and standard deviation of the distribution of the transformed data. Then, a second round estimate of the mean and standard deviation of the distribution of the transformed data is obtained by maximum likelihood estimation conditional on the estimated power parameter. Finally, the inverse transformation is applied to estimate the sample mean and standard deviation of the original, untransformed data.
A object of class mln.mean.sd
. The object is a list with the following components:
est.mean |
Estimated sample mean. |
est.sd |
Estimated sample standard deviation. |
location |
Estimated mean of the Box-Cox transformed data. |
scale |
Estimated standard deviation of the Box-Cox transformed data. |
shape |
Estimated transformation parameter |
bc.norm.rvs |
The random variables generated by the Box-Cox (or, equivalently, power-normal) distribution during the Monte Carlo simulation. |
... |
Some additional elements. |
The results are printed with the print.mln.mean.sd
function.
Cai S., Zhou J., and Pan J. (2021). Estimating the sample mean and standard deviation from order statistics and sample size in meta-analysis. Statistical Methods in Medical Research. 30(12):2701-2719.
McGrath S., Zhao X., Steele R., Thombs B.D., Benedetti A., and the DEPRESsion Screening Data (DEPRESSD) Collaboration. (2020). Estimating the sample mean and standard deviation from commonly reported quantiles in meta-analysis. Statistical Methods in Medical Research. 29(9):2520-2537.
Box G.E.P., and D.R. Cox. (1964). An analysis of transformations. Journal of the Royal Statistical Society Series B. 26(2):211-52.
Luo D., Wan X., Liu J., and Tong T. (2016). Optimally estimating the sample mean from the sample size, median, mid-range, and/or mid-quartile range. Statistical Methods in Medical Research. 27(6):1785-805
Wan X., Wang W., Liu J., and Tong T. (2014). Estimating the sample mean and standard deviation from the sample size, median, range and/or interquartile range. BMC Medical Research Methodology. 14:135.
## 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)) obs.mean <- mean(x) obs.sd <- stats::sd(x) ## Estimate the sample mean and standard deviation using the MLN method mln.mean.sd(q1.val = quants[1], med.val = quants[2], q3.val = quants[3], n = n)
## 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)) obs.mean <- mean(x) obs.sd <- stats::sd(x) ## Estimate the sample mean and standard deviation using the MLN method mln.mean.sd(q1.val = quants[1], med.val = quants[2], q3.val = quants[3], n = n)
This function plots the cumulative distribution functions of the fitted distributions along with the summary data reported by the study (i.e., the S1, S2, or S3 data).
## S3 method for class 'qe.fit' plot( x, distributions = c("normal", "log-normal", "gamma", "weibull"), points = TRUE, limits, col, legend = TRUE, xlab = "x", ylab = "F(x)", ylim = c(0, 1), cex.points = 0.85, pch.points = 16, length.out = 10000, ... )
## S3 method for class 'qe.fit' plot( x, distributions = c("normal", "log-normal", "gamma", "weibull"), points = TRUE, limits, col, legend = TRUE, xlab = "x", ylab = "F(x)", ylim = c(0, 1), cex.points = 0.85, pch.points = 16, length.out = 10000, ... )
x |
object of class "qe.fit". |
distributions |
character vector specifying the names of distributions to be plotted. The options are: |
points |
logical scalar indicating whether to plot the observed summary data (i.e., the sample quantiles reported by the study). The default is |
limits |
numeric vector of length 2 specifying the bounds of the interval in which to evaluate of the cumulative distribution functions. See 'Details'. |
col |
character vector specifying the colors to use for the distributions. The kth element in this vector corresponds to the color to be used for the kth element in the |
legend |
logical scalar indicating whether to plot a legend. The default is |
xlab |
x-axis label. |
ylab |
y-axis label. |
ylim |
y-axis limits. |
cex.points |
The magnification to be used for the plotted observed summary data (i.e., for the |
pch.points |
either an integer specifying a symbol or a single character to be used as the default in plotting the observed summary data (i.e., for the |
length.out |
numeric scalar specifying the number of points to be used for evaluating each of the cumulative distribution functions. |
... |
other graphical parameters (see |
Users may need to use the limits
argument so that a sensible interval is used for plotting. By default, the limits of the interval are the sample minimum and maximum values in scenarios S1 and S3, which is often adequate. In scenario S2, the limits are based on the quantiles of the distribution with the best fit (i.e., the fitted distribution obtaining the smallest distance between observed and distribution quantiles). If the normal distribution is the best fit, the limits of the interval are the 1/n th quantile and 1-1/n th quantile of the fitted normal distribution. If any of the other distributions are selected, the 1/n th quantile and 0.90 quantile are used as the limits of the interval. Depending on the skewness of the data, users may need to adjust the upper limit.
## Example 1 ## Generate S3 summary data set.seed(1) n <- 100 x <- stats::rlnorm(n, 2.5, 1) quants <- stats::quantile(x, probs = c(0, 0.25, 0.5, 0.75, 1)) ## Fit distributions res <- qe.fit(min.val = quants[1], q1.val = quants[2], med.val = quants[3], q3.val = quants[4], max.val = quants[5], n = n) plot(res) ## Example 2 res <- qe.fit(q1.val = 1, med.val = 2, q3.val = 3, n = 100) plot(res, limits = c(0, 5))
## Example 1 ## Generate S3 summary data set.seed(1) n <- 100 x <- stats::rlnorm(n, 2.5, 1) quants <- stats::quantile(x, probs = c(0, 0.25, 0.5, 0.75, 1)) ## Fit distributions res <- qe.fit(min.val = quants[1], q1.val = quants[2], med.val = quants[3], q3.val = quants[4], max.val = quants[5], n = n) plot(res) ## Example 2 res <- qe.fit(q1.val = 1, med.val = 2, q3.val = 3, n = 100) plot(res, limits = c(0, 5))
Print method for objects of class "bc.mean.sd".
## S3 method for class 'bc.mean.sd' print(x, ...)
## S3 method for class 'bc.mean.sd' print(x, ...)
x |
object of class "bc.mean.sd". |
... |
other arguments. |
No value is returned.
## 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)) obs.mean <- mean(x) obs.sd <- stats::sd(x) ## Estimate the sample mean and standard deviation using the BC method res <- bc.mean.sd(q1.val = quants[1], med.val = quants[2], q3.val = quants[3], n = n) print(res)
## 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)) obs.mean <- mean(x) obs.sd <- stats::sd(x) ## Estimate the sample mean and standard deviation using the BC method res <- bc.mean.sd(q1.val = quants[1], med.val = quants[2], q3.val = quants[3], n = n) print(res)
Print method for objects of class "mln.mean.sd".
## S3 method for class 'mln.mean.sd' print(x, ...)
## S3 method for class 'mln.mean.sd' print(x, ...)
x |
object of class "mln.mean.sd". |
... |
other arguments. |
No value is returned.
## 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)) obs.mean <- mean(x) obs.sd <- stats::sd(x) ## Estimate the sample mean and standard deviation using the BC method res <- mln.mean.sd(q1.val = quants[1], med.val = quants[2], q3.val = quants[3], n = n) print(res)
## 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)) obs.mean <- mean(x) obs.sd <- stats::sd(x) ## Estimate the sample mean and standard deviation using the BC method res <- mln.mean.sd(q1.val = quants[1], med.val = quants[2], q3.val = quants[3], n = n) print(res)
Print method for objects of class "qe.fit".
## S3 method for class 'qe.fit' print(x, ...)
## S3 method for class 'qe.fit' print(x, ...)
x |
object of class "qe.fit". |
... |
other arguments. |
No value is returned.
## 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 res <- qe.fit(q1.val = quants[1], med.val = quants[2], q3.val = quants[3], n = n) print(res)
## 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 res <- qe.fit(q1.val = quants[1], med.val = quants[2], q3.val = quants[3], n = n) print(res)
Print method for objects of class "qe.mean.sd".
## S3 method for class 'qe.mean.sd' print(x, ...)
## S3 method for class 'qe.mean.sd' print(x, ...)
x |
object of class "qe.mean.sd". |
... |
other arguments. |
No value is returned.
## 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)) obs.mean <- mean(x) obs.sd <- stats::sd(x) ## Estimate the sample mean and standard deviation using the BC method res <- qe.mean.sd(q1.val = quants[1], med.val = quants[2], q3.val = quants[3], n = n) print(res)
## 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)) obs.mean <- mean(x) obs.sd <- stats::sd(x) ## Estimate the sample mean and standard deviation using the BC method res <- qe.mean.sd(q1.val = quants[1], med.val = quants[2], q3.val = quants[3], n = n) print(res)
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
qe.fit( min.val, q1.val, med.val, q3.val, max.val, n, two.sample.default = FALSE, qe.fit.control = list() )
qe.fit( min.val, q1.val, med.val, q3.val, max.val, n, two.sample.default = FALSE, qe.fit.control = list() )
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.
|
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.
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.
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.
## 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)
## 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)
This function applies the quantile estimation (QE) method to estimate the sample mean and standard deviation from a study that presents one of the following sets of summary statistics:
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
qe.mean.sd( min.val, q1.val, med.val, q3.val, max.val, n, qe.fit.control = list() )
qe.mean.sd( min.val, q1.val, med.val, q3.val, max.val, n, qe.fit.control = list() )
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. |
qe.fit.control |
optional list of control parameters for |
In brief, the QE method fits candidate distribution(s) by minimizing the distance between observed and distribution quantiles. See qe.fit
for further details concerning the distribution fitting step. If multiple candidate distributions are fit, the distribution with the best fit (i.e., the fitted distribution obtaining the smallest distance between observed and distribution quantiles) is selected as the underlying outcome distribution. The mean and standard devition of the selected distribution are used to estimate the sample mean and standard deviation, respectively
A list with the following components:
est.mean |
Estimated sample mean. |
est.sd |
Estimated sample standard deviation. |
selected.dist |
Selected outcome distribution. |
values |
Values of the objective functions evaluated at the estimated paramters of each candidate distribution. |
... |
Some additional elements. |
McGrath S., Zhao X., Steele R., Thombs B.D., Benedetti A., and the DEPRESsion Screening Data (DEPRESSD) Collaboration. (2020). Estimating the sample mean and standard deviation from commonly reported quantiles in meta-analysis. Statistical Methods in Medical Research. 29(9):2520-2537.
## 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)) obs.mean <- mean(x) obs.sd <- stats::sd(x) ## Estimate the sample mean and standard deviation using the QE method qe.mean.sd(q1.val = quants[1], med.val = quants[2], q3.val = quants[3], n = n)
## 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)) obs.mean <- mean(x) obs.sd <- stats::sd(x) ## Estimate the sample mean and standard deviation using the QE method qe.mean.sd(q1.val = quants[1], med.val = quants[2], q3.val = quants[3], n = n)
Summary method for objects of class "qe.mean.sd".
## S3 method for class 'qe.mean.sd' summary(object, digits = 5, ...)
## S3 method for class 'qe.mean.sd' summary(object, digits = 5, ...)
object |
object of class "qe.mean.sd". |
digits |
integer specifying the number of decimal places. |
... |
other arguments. |
A 5 x 3 matrix with columns for the estimated sample mean, estimated standard deviation, and sum of squares (of the objective function used in qe.fit
) under each candidate distribution.
## 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)) obs.mean <- mean(x) obs.sd <- stats::sd(x) ## Estimate the sample mean and standard deviation using the BC method res <- qe.mean.sd(q1.val = quants[1], med.val = quants[2], q3.val = quants[3], n = n) summary(res)
## 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)) obs.mean <- mean(x) obs.sd <- stats::sd(x) ## Estimate the sample mean and standard deviation using the BC method res <- qe.mean.sd(q1.val = quants[1], med.val = quants[2], q3.val = quants[3], n = n) summary(res)