# Simulator - a deterministic function of random variables

In this paper, the first discussion (Universal latent variable representation by C. Andrieu, A. Doucet and A. Lee) authors state that

Sampling exactly $Y \sim f(y|\theta)$ on a computer most often means that $Y=\phi(\theta,U)$ where $U$ is a random vector of probability distribution $D(\cdot)$ and $\phi(\cdot,\cdot)$ is a mapping either known analytically or available as a “black-box".

And they explain it further. I am trying to understand their point but I am lost. I think I managed to use this idea on a simple example. I did a Approximate Bayesian Computation (should work also for the exact) inference using normal likelihood (known mean, unknown precision $\tau$). So in this case $\theta=\tau$, $U\sim U[0,1]$ and $\phi(\cdot,\cdot)$ is a Box-Muller transformation. So when I simulate data from the likelihood, instead of using numpy normal distribution, I simulate $U$ from uniform distribution and use Box-Muller transformation to get my normally distributed data. However, even if I'm right with this example, I don't know how to apply it to real-world problems. In general I am working on a ABC code to infer from an Agent Based Model (that was given to me in NetLogo, I just call it from my code in Python). So instead of having to simulate from $N(\mu, \frac{1}{\tau})$, I have to run the NetLogo model with proposed parameters $\theta$ ($\theta$ is a multidimensional vector). So my only input to NetLogo model are there parameters. My question is: how can I use the idea from this paper in my case? I.e., what would $U$ and $\phi$ be? I would be grateful for any explanation and help!

• Taken literally, the quotation is a trivial statement: it asserts that sampling on a computer requires a random number generator. $\phi$ can be understood to be any computer program, $U$ is the RNG, $\theta$ represents all non-random inputs to the program, and $Y$ is the output. Such statements, although without content, often are used to establish notation or terminology. – whuber Aug 9 '16 at 12:54

In the context of ABC, you want to simulate from $y$, which is a realization of your model for a fixed value of the parameter $\theta$. Then, in the step when you simulate from $y\sim f(\vert\theta)$, for a given $\theta$, the way you simulate from $f(\vert\theta)$ defines the function $\phi(U,\theta)$. This might be a complicated function, depending on your model. The specific expression of $\phi$ can only be obtained (if at all possible) in a case by case analysis. If you want to know the explicit expression of $\phi$ in a model of interest, you will need to ask a new question with all the details about the model you want to simulate from.
• I wrote: "I simulate U from uniform distribution and use Box-Muller transformation to get my normally distributed data." Isn't it exactly what you are saying? I think I understand what $\phi$ is, but I don't know what $U$ would be. – Paula Aug 9 '16 at 13:32
• @Paula I see, my point is that you don't need to know anything about priors in order to simulate from a normal distribution using BMT. $U$ is nothing but a uniform random variable, which is the atom of any simulation, even in complex models. – Scorpion Aug 9 '16 at 13:38
• @Paula According to the cited paper, $U$ is a latent variable with distribution $D$. This can be a normal, logistic, or what have you. However, in order to simulate from any distribution, you always start from a uniform random simulation and somehow transform it into a sample from the desired distribution. Like in your normal example. Sometimes this step is hidden since you simulate from a more complex distribution using software, but inside this software, there is a uniform random variable, which is the only thing, with known distribution, we know how to simulate from. – Scorpion Aug 9 '16 at 13:43
• It seems to me that you are using those codes as a "black box" and hence cannot find the transform function $\phi$ without opening the codes. In that sense your question has no answer. – Xi'an Aug 9 '16 at 15:14