Description Usage Arguments Details Value References Examples

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

1 2 3 4 5 6 7 8 9 10 | ```
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 |

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.

1 2 3 4 5 6 7 8 9 10 11 | ```
## 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)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.