1

Here is a single exponential example:

library(tidyverse)
# Single Exponential ----
set.seed(1)
n <- 100e3
p <- 0.75
rate <- 1/110000000
distrib <- rexp(n, rate) %>% quantile(p)
analytical <- qexp(p, rate)

Both the distrib and analytical methods produce similar results ~152m

However, when I add 3 exponential distributions together the results from distrib and analytical diverge:

m9 <- 11000000
m10 <- 34785054
m11 <- 110000000

w9 <- 0.06756349
w10 <- 0.00030828
w11 <- 0.04856016

# Triple Exponential Function ----
r3exp2 <- function(n, w1, w2, w3, m1, m2, m3){
sim <- n
w1 * rexp(sim, 1 / m1) + w2 * rexp(sim, 1 / m2) + w3 * rexp(sim, 1 / m3)
}

q3exp <- function(p, w1, w2, w3, m1, m2, m3) w1 * qexp(p, 1 / m1) + w2 * qexp(p, 1 / m2) + w3 * qexp(p, 1 / m3)

# Output ----

distrib <- r3exp2(n, w9, w10, w11, m9, m10, m11) %>% quantile(p)
analytical <- q3exp(p, w9, w10, w11, m9, m10, m11)

i.e. 8.4m vs. 8.2m; this is the case even with a higher number of simulations. The divergence gets bigger yet when I add more exp distributions.

Are these two approaches (distrib vs. analytical) equivalent? I am unsure what is driving the difference.

Thanks.

  • You appear to be simulating from an exponential distribution and then from a linear combination of three exponentials. Those aren't the same distribution, so could you please explain what you mean by "approaches equivalent"? Later in the code you take linear combinations of quantiles of distributions. Even later you do stuff that's incomprehensible because your variables have no values. Could you explain in English or in mathematics what you're trying to ask? – whuber Apr 05 '19 at 20:11
  • @whuber - hopefully the edits clarify my question. – Vincent Risington Apr 05 '19 at 20:30
  • Thank you--that helps. – whuber Apr 05 '19 at 21:18
  • Are you interested specifically in linear combinations of exponentially-distributed variables? – whuber Apr 06 '19 at 16:56
  • @whuber - I figured this out. Basically I'm sampling from 3 uncorrelated exponential deviates. The correct simulation function should be:`r3exp2 % qmixexp(w1, w2, w3, m1, m2, m3) }` this imposes 100% correlation which is consistent with the analytical approach. – Vincent Risington Apr 06 '19 at 19:00
  • That's unclear: what do you do when you sample? Are you adding the results, as shown in your code, or doing something else? The issue is that mixtures of exponentials are relatively easy to handle (although not as shown in your code), whereas linear combinations of them are trickier. It turns out, though, that a linear combination of exponentials can be expressed as a mixture: see https://stats.stackexchange.com/questions/72479 (an exponential distribution is a special form of Gamma distribution). – whuber Apr 06 '19 at 19:04
  • Thanks I'll read that link. – Vincent Risington Apr 06 '19 at 19:13

0 Answers0