0
$\begingroup$

Say I have an exponential distribution with parameter lambda λ. Is there a way to generate 100-500 pre-computed values that when summed, have the same variance and mean as the exponential (and the same distribution). How can I:

  1. generate these values?
  2. prove that they fit an exponential distribution?

One possible solution: generate the values to simulate maybe 10 million values and then group them into buckets somehow? Is there a good algorithm for this? I figure if this is done right, part 2 is not that necessary.

$\endgroup$
1
  • 1
    $\begingroup$ Could you clarify what you mean by "when summed"? That phrase indicates you have a single value -- the sum -- which leaves us wondering what you're trying to accomplish. $\endgroup$
    – whuber
    Dec 5, 2022 at 14:15

1 Answer 1

1
$\begingroup$
######################################
# PARAMETERS & INITIALIZATION        #

lambda <- 10
M <- 1000
set.seed(1)

######################################
# SIMULATION                         #

E <- rexp(1,lambda)   # one exponential random variable
U <- runif(M)         # M uniform random variables
X <- E * U / sum(U)   # M random variables satisfying the requirements
$\endgroup$
11
  • $\begingroup$ can you add some annotations my good sir? $\endgroup$ Dec 5, 2022 at 5:28
  • $\begingroup$ Comments added. $\endgroup$
    – stans
    Dec 5, 2022 at 5:46
  • 1
    $\begingroup$ This is R but the idea is to show you a simple algorithm which you can implement in a language of your choice. $\endgroup$
    – stans
    Dec 5, 2022 at 5:52
  • 1
    $\begingroup$ The few variable manipulations I have utilized are quite standard across R, Matlab, Python, Stata, etc. You do need to learn at least one statistical language before asking the questions like the one above. In particular, this tutorial (tutorialspoint.com/r/index.htm) will get you going in no time. $\endgroup$
    – stans
    Dec 5, 2022 at 6:20
  • 2
    $\begingroup$ This standardizes the mean, but how do you achieve the requirement on the variance?? $\endgroup$
    – whuber
    Dec 5, 2022 at 14:14

Not the answer you're looking for? Browse other questions tagged or ask your own question.