mercredi 8 juin 2022

Evaluating convergence of a random variable (unknown expected value)

I have a stochastic simulation model that produces random deviates of a variable, whose expected value is unknown. I would like to determine the minimal number of simulations necessary to obtain convergence of the mean of the random variable.

For instance, using a reproducible example:

sample_size <- 10000
X <- runif(sample_size)
plot(sapply(seq_len(sample_size),
            function(i) mean(y[seq_len(i)])),
     type = "l",
     ylim = c(0, 1),
     xlab = "Number of samples, n",
     ylab = "Average of n samples")

enter image description here

Here, I would like to determine the minimal sample_size to obtain convergence of the mean of X (here probably somewhere between 2000 and 10000), while the expected value of X is unknown (for the reproducible example I know that the expected value is 0.5, but let's pretend we ignore that).

Any advice on the method I should use?




Aucun commentaire:

Enregistrer un commentaire