# Sampling random numbers from a distribution with asymmetric confidence intervals generated by a bootstrapped estimate

So, I'm working on a problem where I have a sample distribution with a reported, mean and an asymmetric confidence interval from bootstrapped sampling of the initial population (this is from a meta-analysis - so, I also have the # of bootstrap replicates and the original sample size). Given this information, I would like to draw a random variable (I'm then going use it to construct my own bootstrapped sample using other similar variables - basically, a meta-analysis of meta-analyses). I'm sure this is simple, but I'm completely blanking on how one would do this - is there an appropriate distribution to draw from or way to back-engineer reported results to create one? R code would be great (if there is a package to do this), or just a see-this-reference, as I'm drawing a blank.

N.B. I think my larger question here was, if you have the quantiles for a population, but no other distributional knowledge or data, is it possible to create a method to draw random numbers based on that information. But perhaps the answer there is no.

• What kind of asymmetry are we talking about? Some sort of truncation one one side or the other of what would otherwise be a normal distribution? Or some entirely different, unspecified distribution? – Fomite Sep 13 '11 at 20:52
• Are you trying to draw from the underlying population distribution, or from the sampling distribution for the sample mean? – Karl Sep 14 '11 at 13:43
• @EpiGrad It depends. I have bootstrapped means and CIs for meta-analyses of studies. That's it. The distributions are not specified. – jebyrnes Sep 14 '11 at 19:27

It seems to me that your question is ill-posed (which was pointed out by Aniko already). If you know the mean, your uncertainty about it is zero, so the confidence interval should have zero length.

Assuming that you somehow have the mean right, in whatever sense is suitable for you, and a confidence interval that comes from another source, you can reverse-engineer Johnson's (1978) procedure to come up with a measure of skewness of the original distribution (see also Chen's (1995) extension), and then pick say a skew-normal or a (shifted, if needed) gamma distribution with the required properties.

UPDATE: Let us look at Johnson (1978) formula (2.7) for the confidence interval: $[\bar x + \kappa / 6 s^2 n] \pm t_\alpha(n-1) s / \sqrt{n}$, where I refer to the skewness of the original distribution as $\kappa$. If you are given the mean xbar, the lower limit cl, the upper limit cu and the sample size n (we'd have to assume i.i.d. data there), then

    talpha = qt(p=0.975,df=n-1)
s = (cu - cl)*sqrt(n)/(2*talpha)
kappa = 6*s*s*n*( cl - xbar + talpha*s/sqrt(n) )
gamma.shape = 4/(kappa*kappa)
gamma.scale = s/sqrt(gamma.shape)
gamma.shift = xbar - gamma.shape*gamma.scale
simulated.data = rgamma(n = simulated.n, shape = gamma.shape, scale = gamma.scale) + gamma.shift


See if it produces reasonable results. I like the skew-normal distribution better, as the normal distribution, a standard reference, can be produced with the skew.normal.shape = 0 rather than gamma.shape = infinity in the gamma case, but the computations are more cumbersome.

• Thanks, Stas! I should have just emailed you. It's precisely that kind of reverse-engineering I'm trying to do, as all I have are the reported summary information from past meta-analyses. Some are generated from bootstrapped estimation, some not. I just have no experience in it or the relevant literature of how to combine the two into a single measure without going back to the original studies. So thanks for the refs, as always! – jebyrnes Sep 14 '11 at 19:26
• Oh, that's you, Jarrett. Ah well. That's an odd and difficult problem, and there is no right solution to it, I am afraid. Let me go back and update my answer with the explicit formulae based on Johnson (1978), then. – StasK Sep 15 '11 at 16:13
• Awesome - thanks, Stas! We're going to go with your solution and use a skew normal from the fGarch package. Should be perfect. – jebyrnes Sep 15 '11 at 20:50
• There is an obvious typo barx->xbar in the R code; (the SE doesn't let me edit it since the change is less than 6 characters) – Adam Ryczkowski Jan 21 '13 at 8:44
• Thank, Adam. (I have to type more so that the comment is more than 15 characters :) ) – StasK Jan 21 '13 at 21:02

I don't have a full answer for you, but several issues are worth pointing out:

1. You cannot draw random values from a confidence interval of a parameter, because it is a frequentist concept, and parameters do not have distributions in frequentist statistics. The most you can do is to try to sample the sampling distribution of the parameter estimate.
2. If you want to bootstrap a meta-analysis, bootstrap the studies that go into it.
3. Most assymetric confidence intervals are symmetric on some other scale, typically the log-scale. For example, the typical confidence interval for an odds ratio (OR) is constructed as symmetric for log(OR) and then exponentiated. So I would certainly check whether a log-transform would make the confidence interval symmetric.
• Sadly, I don't have the original studies. All I have is reported means and CIs of log ratios. Some are symmetric and calculated parametrically. Others are bootstrapped, and hence, asymmetric. I'm essentially summarizing a number of different meta-analyses into a single measure. I do like the idea of the transformation to inspect the properties on another scale. That might be a nice way to go. – jebyrnes Sep 14 '11 at 19:23

Here is a half-baked idea for trying to avoid the "impossible" problem of sampling from a confidence interval. If you want to do a bootstrap analysis of those meta-analyses, you should be bootstrapping the result of each meta-analysis, not its potential results. The only problem is that those meta-analyses have different precision, so you probably want them to have different weights for the bootstrap sample. The weight might depend on the total number of subjects that went into each meta-analysis, or the width of the confidence interval (which are, of course, related). In many similar situations inverse variance weighting turns out to be optimal, so I think weighing by sample size or by the inverse square of the width of the confidence interval would be reasonable choices. Of course, for the confidence interval width it would be better to have a scale on which the interval is somewhat symmetric, but for ratios the log-transform would (approximately) do that, even for a bootstrap interval.

Again, I am not sure how well this would work - you might want to run some simulation studies, but it might be a more straightforward approach.

Unfortunately there are an infinite number of distributions that could have resulted in the confidence interval given. One option to generate from one of those distributions would be to generate a random uniform, if it is below 0.025 (assuming 95% confidence interval) then choose a value slightly less than the lower confidence limit, if it is higher than 0.975 choose a value slightly higher than the upper confidence limit, otherwise choose a uniform between the 2 confidence limits.

Something a little more realistic would be to use the logspline package in R. The oldlogspline function allows you to specify data as interval censored, so you could specify that 5 points came from less than the lower confidence limit, 5 points came from greater than the upper confidence limit, and 190 points came from between the 2 confidence limits. This would then give a smooth curve with approximately the confidence limits that you have, you could then change some of the 190 points from interval censored to actual values close to the mean to get the mean and asymmetry. Then tweak the values of those points until the mean and quantiles are close enough. Then the roldlogspline function will generate data from the distribution that you created. It probably will not be the exact distribution that generated the bootstrap mean and interval, but it is one of those that could have and would have good properties.