Linked Questions

3
votes
1answer
21k views

Generate sample data from Gaussian mixture model [duplicate]

I am given the values for mean, co-variance, initial_weights for a mixture of Gaussian Models. Now how can I generate samples given those: In brief, I need a function like ...
3
votes
1answer
6k views

Sampling from a multivariate Gaussian mixture model [duplicate]

How can I generate multi-dimensional data from a (estimated) Gaussian mixture pdf? In general, what would be ways to generate multi-dimensional data from a pdf? I read rejection sampling can be used, ...
1
vote
1answer
102 views

Getting random number from Weighted sum of Normal distribution functions [duplicate]

I've a weighted sum of the 2 Gaussian distribution functions as below. How can I get a random number based on this sum of functions. The number of functions can vary up to 10.
2
votes
1answer
7k views

sampling from a mixture of two Gamma distributions

Assuming that all the mixture parameters are known, how can one sample from a mixture of $\texttt{Gamma}(\alpha,\beta)$ distributions: $$\theta \sim \pi \texttt{Gamma}(\alpha_1,\beta_1)+(1-\pi)\texttt{...
3
votes
3answers
3k views

How to randomly generate random numbers in one of two intervals

I am trying to generate random numbers with R, uniformly from one of two different intervals. I want the numbers to be generated, for example, in the intervals [-0.8,-0.4] or [0.3,0.9]. I am trying to ...
8
votes
2answers
1k views

Simulate from a dynamic mixture of distributions

I need to sample from the following mixture of two distributions: $h_{\vec{\beta}}(r)=c(\vec{\beta})[(1-w_{m,\tau}(r))f_{\vec{\beta_{0}}}(r)+w_{m,\tau}(r)g_{\epsilon,\sigma}(r)]$ where $c(\vec{\beta}...
8
votes
2answers
256 views

Setting up simulation algorithm to check calibration of Bayesian posterior probabilities

Figuring out how to simulate something is often the best way to understand the underlying principles. I am a bit at a loss on exactly how to simulate the following. Suppose that $Y \sim N(\mu, \...
5
votes
3answers
107 views

Simulating random variables from a discrete distribution

I have the following discrete distribution where $p$ is a known constant: $p(x,p)= \frac{(1-p)^3}{p(1+p)}x^2p^x , (0<p<1), x=0, 1, 2, \ldots$ . How can I sample from this distribution?
1
vote
1answer
404 views

Why is weighing random observations according to their probability from all distributions wrong?

Is sampling all distributions n times and then talking out i numbers from each sample, where i is probability of that distribution * n, wrong? Suppose $$ 0.3\!\times\mathcal{N}(0,1)\; + \;0.5\!\...
1
vote
1answer
309 views

Why the sample method of mixture distribution works?

For example this thread: Generating random variables from a mixture of Normal distributions First choose a distribution according to the weights. Then sample from the chosen distribution. How to ...
2
votes
2answers
259 views

Generating functional-form PDF from Max Likelihood Estimation

For the purpose of this question, please consider me a stats newbie. I'm working on a (very fun!) research project which involves estimating a pdf of "personal values" -- i.e. how much a certain ...
3
votes
1answer
106 views

Simulate mixture of betas

Suppose that we have $X_1, ..., X_n$ iid such that $X_i| \theta \sim Ber(\theta)$ and $\theta \sim g(\theta)$ such that $$g(\theta) = 0.6 Beta(2,1) + 0.4 Beta(1,1) = 1.2 \theta + 0.4$$ Doing the ...
1
vote
0answers
118 views

sample from a distribution raised to a power [closed]

If I know how to simulate the distribution $\pi(\mathbf{x})$, then is there a way to directly generate samples of $(\pi(\mathbf{x}))^\beta$ for some $\beta > 0$ ?(assume that it can be normalised ...
1
vote
1answer
52 views

Generating random variable from no closed-form marginal density [closed]

Suppose $u\sim N(0,I_p)$ and $Y|U\sim N(x(t),\sigma_e^2I_m)$, and the marginal distribution of $y$ is $f(y)=\int_u f(y|u)f(u)du$. $x(t)$ is composite function of $u$, basically $x(t)$ is a function of ...
1
vote
0answers
67 views

Sample from a quotient of mixture distributions

I want to sample from a random variable $Z=\frac{X}{Y}$, where $X$ and $Y$ are mixtures of distributions. I figured out, how to sample from a mixture distribution (e.g. Generating random variables ...

15 30 50 per page