Questions tagged [monte-carlo]

Using (pseudo-)random numbers and the Law of Large Numbers to simulate the random behavior of a real system.

Filter by
Sorted by
Tagged with
41
votes
6answers
33k views

Rule of thumb for number of bootstrap samples

I wonder if someone knows any general rules of thumb regarding the number of bootstrap samples one should use, based on characteristics of the data (number of observations, etc.) and/or the variables ...
35
votes
6answers
6k views

Are all simulation methods some form of Monte Carlo?

Is there a simulation method that is not Monte Carlo? All simulation methods involve substituting random numbers into the function to find a range of values for the function. So are all simulation ...
12
votes
1answer
2k views

Sampling from marginal distribution using conditional distribution?

I want to sample from a univariate density $f_X$ but I only know the relationship: $$f_X(x) = \int f_{X\vert Y}(x\vert y)f_Y(y) dy.$$ I want to avoid the use of MCMC (directly on the integral ...
33
votes
4answers
23k views

K-fold vs. Monte Carlo cross-validation

I am trying to learn various cross validation methods, primarily with intention to apply to supervised multivariate analysis techniques. Two I have come across are K-fold and Monte Carlo cross-...
7
votes
2answers
2k views

Can I use bootstrapping to estimate the uncertainty in a maximum value of a GAM?

I have data from an experiment where I look at the development of algal biomass as a function of the concentration of a nutrient. The relationship between biomass (the response variable) and the ...
18
votes
1answer
8k views

MCMC on a bounded parameter space?

I am trying to apply MCMC on a problem, but my priors(in my case they are $\alpha\in[0,1],\beta\in[0,1]$)) are restricted to an area? Can I use normal MCMC and ignore the samples that fall outside of ...
11
votes
1answer
3k views

Monte carlo simulation in R

I am trying to solve the following exercise but I actually have no clue on how to start doing this. I've found some code in my book that looks like it but it's a completely different exercise and I ...
16
votes
2answers
5k views

What are some techniques for sampling two correlated random variables?

What are some techniques for sampling two correlated random variables: if their probability distributions are parameterized (e.g., log-normal) if they have non-parametric distributions. The data are ...
7
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}...
7
votes
1answer
3k views

Monte Carlo estimation of probabilities

I would appreciate some advice on how to use Monte Carlo for estimating probabilities. Generally speaking the problem I have involves running an experiment and counting the frequency of output (which ...
7
votes
2answers
2k views

What are Monte Carlo simulations?

Is Monte Carlo Simulation the same as just conducting experiment several times and then averaging results? Why is it then called like that?
4
votes
1answer
819 views

How can one compute Lilliefors' test for arbitrary distributions?

My question is actually a follow-up to Glen_b's answer to the question "Simulation of KS-test with estimated parameters." I am mostly interested on how to compute Lilliefors' test (or, more exactly, ...
41
votes
1answer
7k views

How to determine significant principal components using bootstrapping or Monte Carlo approach?

I am interested in determining the number of significant patterns coming out of a Principal Component Analysis (PCA) or Empirical Orthogonal Function (EOF) Analysis. I am particularly interested in ...
12
votes
2answers
13k views

How to create a toy survival (time to event) data with right censoring

I wish to create a toy survival (time to event) data which is right censored and follows some distribution with proportional hazards and constant baseline hazard. I created the data as follows, but I ...
8
votes
2answers
2k views

Rao-Blackwellization of Gibbs Sampler

I am currently estimating a stochastic volatility model with Markov Chain Monte Carlo methods. Thereby, I am implementing Gibbs and Metropolis sampling methods.Assuming I take the mean of the ...
5
votes
1answer
2k views

Problem with informative censoring

I am reading "Monte Carlo Statistical Methods" by Robert and Cassella, and problem 1.3 asks In example 1.1, the distribution of the random variable $Z=\min(X,Y)$ was of interest. Derive the ...
12
votes
2answers
4k views

Finding precision of Monte Carlo simulation estimate

Background I am designing a Monte Carlo simulation that combines the outputs of series of models, and I want to be sure that the simulation will allow me to make reasonable claims about the ...
5
votes
2answers
6k views

Number of samples needed in Monte Carlo simulation: how good is this approximation?

In Risk Theory Beard, Pentikanen and Pesonen (1969) mention a method of assessing number of samples needed for Monte Carlo simulation as $$ \sigma = \sqrt{\frac{p(1-p)}{s}} \leq \frac{1}{2} \sqrt{ \...
36
votes
1answer
13k views

What is the difference between Metropolis-Hastings, Gibbs, Importance, and Rejection sampling?

I have been trying to learn MCMC methods and have come across Metropolis-Hastings, Gibbs, Importance, and Rejection sampling. While some of these differences are obvious, i.e., how Gibbs is a special ...
30
votes
5answers
7k views

Generating random numbers manually

How can I manually generate a random number from a given distribution, as for instance, 10 realisations from the standard normal distribution?
35
votes
6answers
9k views

Approximate $e$ using Monte Carlo Simulation

I've been looking at Monte Carlo simulation recently, and have been using it to approximate constants such as $\pi$ (circle inside a rectangle, proportionate area). However, I'm unable to think of a ...
8
votes
4answers
2k views

Simulation involving conditioning on sum of random variables

I was reading this question, and thought about simulating the required quantity. The problem is as follows: If $A$ and $B$ are iid standard normal, what is $E(A^2|A+B)$? So I want to simulate $E(A^2|A+...
5
votes
2answers
1k views

Not sure if standard error of p-values makes sense in Fisher Exact Test

I am working on implementing a Fisher Exact Test for some unemployment and wage data. The idea is to describe two populations (one receiving an assistance program (the "treatment") and one not ...
7
votes
1answer
1k views

Is Monte Carlo uncertainty estimation equivalent to analytical error propagation?

If I have a deterministic, analytic model, $y=f(x)$, I can analytically calculate the uncertainty in $y$ from a known uncertainty in $x$, $\sigma$. Or I can do a Monte Carlo integration: sample from ...
4
votes
1answer
612 views

Confidence interval for the p-value estimate when doing Monte Carlo testing

The second paragraph of the Monte Carlo testing section of the Wikipedia article on resampling statistics, the values of a confidence interval for a p-value from a MC sampling is given: After $N$ ...
4
votes
2answers
201 views

Random process not so random after all (deterministic)

I would like to show (demonstrate by simulation) a random process that turns out after $i$ interactions to be deterministic, i.e. ends at predefined value (roughly) known at time $t=1$. Conditions ...
1
vote
1answer
177 views

Estimating When A Time Series with Random Spikes Crosses a Threshold for the First Time

tl;dr Is there a way to estimate when a random spike in a time series would cross a threshold for the first time? The following is data of my performance in the game Super Hexagon, whose goal is to ...
11
votes
1answer
17k views

Coverage probabilities of the basic bootstrap confidence Interval

I have the following question for a course I'm working on: Conduct a Monte Carlo study to estimate the coverage probabilities of the standard normal bootstrap confidence interval and the basic ...
12
votes
4answers
6k views

Bootstrap, Monte Carlo

I have been set the following question as part of homework: Design and implement a simulation study to examine the performance of the bootstrap for obtaining 95% confidence intervals on the mean of ...
15
votes
2answers
1k views

What is the connection between Markov chain and Markov chain monte carlo

I am trying to understand Markov chains using SAS. I understand that a Markov process is one where the future state depends only on the current state and not on the past state and there is a ...
14
votes
1answer
3k views

Scrambling and correlation in low discrepancy sequences (Halton/Sobol)

I am currently working on a project where I generate random values using low discrepancy / quasi-random point sets, such as Halton and Sobol point sets. These are essentially $d$-dimensional vectors ...
10
votes
3answers
6k views

G-test vs Pearson's chi-squared test

I'm testing independence in an $N \times M$ contingency table. I don't know whether the G-test or Pearson's chi-squared test is better. The sample size is in the hundreds but there are some low cell ...
9
votes
2answers
5k views

How does the proof of Rejection Sampling make sense?

I am taking a course on Monte Carlo methods and we learned the Rejection Sampling (or Accept-Reject Sampling) method in the last lecture. There are a lot of resources on the web which shows the proof ...
5
votes
1answer
329 views

Are the mean of samples taken from Metropolis-Hastings MCMC normally distributed?

I've come across the following theorem while studying MCMC. It seems to suggest that the sample mean taken from the MCMC – the posterior marginal expectation – should be normally distributed, using ...
4
votes
1answer
2k views

Explanation regarding Gibbs Sampling

I am new to MCMC and reading a intro paper regarding Gibbs sampling. However, there are two parts in the paper I cannot understand and get stuck. The first part is equation 2.3 in page 168. It says ...
11
votes
6answers
3k views

How should one approch Project Euler problem 213 (“Flea Circus”)?

I would like to solve Project Euler 213 but don't know where to start because I'm a layperson in the field of Statistics, notice that an accurate answer is required so the Monte Carlo method won't ...
10
votes
1answer
9k views

Required number of simulations for Monte Carlo analysis

My question is about the required number of simulations for Monte Carlo analysis method. As far as I see the required number of simulations for any allowed percentage error $E$ (e.g., 5) is $$ n = \...
9
votes
2answers
2k views

Robust MCMC estimator of marginal likelihood?

I'm trying to compute the marginal likelihood for a statistical model by Monte Carlo methods: $$f(x) = \int f(x\mid\theta) \pi(\theta)\, d\theta$$ The likelihood is well behaved - smooth, log-...
6
votes
1answer
712 views

The fundamental theorem of simulation

The Fundamental Theorem of Simulation Simulating $X \sim f$ is equivalent to simulating $(X,U) \sim \mathscr{U}\{(x,u): 0<u<f(x)\}$ The proof is trivial. One thing that is made clear by ...
5
votes
2answers
384 views

How to generate two groups of $n$ random numbers in $U(0,1)$ such that sum of these two groups equal?

I want to have two groups of $n$ random numbers $u_i$ and $v_i$ in $U(0,1)$, such that $\sum u_i = \sum v_i$ What I tried is: I can firstly get $u_i$ by $U\sim U(0,1)$, make $s=\sum u_i$. Then I ...
4
votes
2answers
725 views

Possible to use draws from two distributions to get draw from distribution with density their product?

Suppose I have a set of draws from a distribution with density $f$ and a set of draws from a distribution with density $g$, where $f$ and $g$ are unknown. Is there some way to use these use these ...
8
votes
2answers
989 views

Solving a simple integral equation by random sampling

Let $f$ be a nonnegative function. I am interested in finding $z \in [0,1]$ such that $$ \int_0^{z} f(x)\,dx = \frac{1}{2}\int_0^1 f(x)\,dx$$ The caveat: all I can do is sample $f$ at points in $[0,1]$...
4
votes
1answer
2k views

Difference between Sequential Importance Resampling and Sequential Monte Carlo

I'm trying to understand this paper but I can't figure out what the difference between SIR and SMC is. I thought that SIR is an example of SMC but the authors seem to distinguish between them. They ...
3
votes
1answer
3k views

Using the rejection sampling with the method of inversion

I am hoping to write some rejection algorithm code in R to approximate a $\text{Gamma}(k,\lambda)$ distribution. The problem is more for educational purposes than real-world implementation. Given an ...
1
vote
1answer
1k views

Variance for hit-and-miss Monte Carlo method and importance sampling

Variance for Hit-and-Miss Monte Carlo is given by $Var(\theta)=\frac{\Theta*(1-\Theta)}{N}$ where $\theta$ is the estimated probability of Hit and N is the number of simulations. Can someone explain ...
6
votes
2answers
546 views

For Hamiltonian Monte Carlo, why does negating the momentum variables result in a symmetric proposal?

I have been going through Radford Neal's excellent HMC book chapter in detail. However, there is one detail that I'm really obsessing with now, and I'm not sure if I'm thinking about it right. When ...
5
votes
2answers
1k views

Delta function in monte carlo sampling

I am confused by the dirac delta function in the formulation of monte carlo sampling. http://www.cs.ubc.ca/~arnaud/doucet_johansen_tutorialPF.pdf, for instance, defines in section 3.1 page 8 the ...
4
votes
4answers
1k views

Difference between Excel's RAND(), RAND()*RAND(), etc

I plotted below the standarized results of: RAND() RAND() * RAND() ... RAND() * RAND() * RAND() * RAND() * RAND() * RAND() It seems that the results are getting to zero, is that because you're ...
4
votes
1answer
170 views

In exactly what sense do MCMC draws approximate the target?

Background We want to sample from some intractable density $\pi(\theta)$. Using an MCMC algorithm, we generate a sample of draws $\{\theta_i\}_{i=1}^N$ from a Markov chain that has $\pi(\theta)$ as ...
2
votes
3answers
8k views

Generating Beta distributions with Uniform generators

I can generate as many samples from one or more uniform distribution (0,1) as I wish. How can I use this to generate a beta distribution ?