Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [simulation]

A vast area which includes generating results from computer models.

0
votes
0answers
12 views

How to do a simulation for hypothesis testing in R? [on hold]

This is my data set called native. This data set has 500 rows of data, but here I've displayed only 9 rows of data. ...
1
vote
0answers
9 views

simr power simulation testing interaction term for 2 factors

I have a model with two factors: a (4 levels) and b (3 levels). Each participant receives two problems (id as a random effect). I want to estimate sample size based on pilot data to give me ...
0
votes
0answers
15 views

Number of iterations for a simulation without knowing standard deviation

Is it possible to determine the number of required iterations of an experiment/simulation to fall within a pre determined confidence interval, without running a default number of simulations to ...
0
votes
0answers
20 views

An optimal stochastic problem and Monte-carlo

Assume we are in a Brownian filtration where I denote $W$ the Brownian motion. My problem is to numerically compute $$ \min_X E (\int^1_0 X^2_tdt),\ \ \ \ (*) $$ where $X$ is adapted to the filtration ...
10
votes
2answers
95 views

How do Bayesians verify their methods using Monte Carlo simulation methods?

Background: I have a PhD in social psychology, where theoretical statistics and math were barely covered in my quantitative coursework. Through undergrad and grad school, I was taught (much like many ...
0
votes
0answers
12 views

Bernoulli essays r [on hold]

Consider a fair coin. Let $H_n=0$ if you observe tail and $H_n=1$ is you observe face. Then $P(H_n=0)=P(H_n=1)=\frac 12$. The distribution of $S_n=H_1+\cdots+H_n$ is binomial with parameters $n$ and $...
0
votes
0answers
52 views

Simulation jam and butter toast in r [closed]

There is a simulation problem: Mr. Murphy eats jam and butter toast every morning for breakfast. Mr. Murphy believes that if he throws the toast, it will definitely land on its buttered and ...
2
votes
1answer
56 views

Compute truncated normal distribution with specific mean and variance

I have a simple setting: I simulate demand patterns that are distributed according to a truncated normal distribution with a given mean and variance after truncation. The truncation is from the left ...
-1
votes
0answers
18 views

Estimating bias in linear regression and linear mixed model in R simulation

I want to run simulations to estimate bias in linear model and linear mixed model. The bias is E(beta)-beta where beta is the association between my X and Y. I generated my X variable from a normal ...
0
votes
1answer
30 views

How to sample/fit distribution from/for bi-modal data [closed]

The context is: I have a sequence of data, of which the histograms show a bi-modal pattern. My final goal is to sample from this sequence in a simulation project. Now we want to fit a parametric model ...
2
votes
1answer
22 views

Optimal distribution for Acceptance Rejection Sampling

For some project I have been sampling from the Gamma distribution. I have been using the exponential distribution intensively. One method I have employed is the Acceptance rejection sampling, ...
0
votes
1answer
24 views

Generation of synthetic data for Hierarchical clustering

I wanted to test various hierarchical clustering algorithms to check which algorithm performs best. For this, I was considering simulating some ground truth. Is the possible to generate a correlation ...
1
vote
1answer
26 views

Why is resampling in bootstrapping? Can you resample too much?

I'm a stats consumer but by no means a statistician. I'm a little confused about how resampling an existing sample can bring useful information, but I get the general idea that you can generate ...
2
votes
1answer
39 views

Manual simulation of Markov Chain in R

Consider the Markov chain with state space S = {1, 2}, transition matrix and initial distribution α = (1/2, 1/2). Simulate 5 steps of the Markov chain (that is, simulate X0, X1, . . ...
0
votes
0answers
8 views

Generating new samples from dataset to expand dataset

I want to choose one dataset and then expand the dimensions/number of samples to show how a dimension reduction method(not yet decided) reacts to changes in dimensions/number of samples. My plan was ...
-1
votes
1answer
66 views

INAR(1) simulation in R [closed]

How do we simulate values of $Y_t$ for a maximum value of $t=60$ when we have an INAR(1) process as follows: $Y_t=ρ^*Y_{(t-1)}+R_t$ where $t$ takes values from 1 to 60, $ρ=0.3,0.8$, $ρ^*$ is ...
1
vote
1answer
30 views

How do you verify independence of a pair of uniform random variables in MATLAB? [closed]

If $A$ is a subset of $R$ and $X$ is a random variable. I have two variables $X_1$ and $X_2$. $I$ being $1$ if $X$ in subset $A$, and $0$ if not in $A$. Let $U$~$U(0;1)$ and determine if this pair ...
5
votes
1answer
108 views

Approximate density from moments and quantiles, then sample from it

Situation I need to send R code to a third party to run estimations for me (I will not be able to work with the data directly). I want to simulate data to test some of the estimators before sending ...
1
vote
0answers
31 views

When to use ordinary, balanced, antithetic, or permutation resampling for bootstrap?

I am using boot and would appreciate any explanation as to when using each of these resampling methods would be recommended in practice. I have come across Do who says that: Simulation results ...
1
vote
0answers
24 views

Generate yearly time series

I've 5 years of historical hourly wind-speeds for a certain location available. What I need to do is to estimate the distribution of the yearly average wind speed. What method do I need such that I ...
1
vote
1answer
32 views

Minimum number of data to check normality

I want to know the minimum number of data required to check normality of my data, I found in Minitab it should >= 20 , other say should be 30 data, on what basis this number is based, and in this case ...
0
votes
1answer
49 views

How do I simulate this data?

I have a distribution of patient appointment booking time that looks like below. How can I simulate this data in excel? I am confused as to what distribution I should be using, it is not uniform or ...
1
vote
1answer
42 views

Books for self-learning about statistic Simulation?

Preferably an introductory book, i.e. for undergrad (or notes or something like that) that explains concepts with detail and with lots of examples, without losing the formality. That covers the ...
1
vote
0answers
26 views

Mixed Exponential Distribution Simulated vs. Analytical Percentiles

Here is a single exponential example: ...
1
vote
0answers
23 views

Computing the credible region from a pre-computed list of function evaluations

I have a nonlinear function of four variables $f(x_1,x_2,x_3,x_4)$. This function outputs three things: $[y_1, y_2, y_3]$. (In reality, the function $f$ is a simulation which solves the equations of ...
0
votes
1answer
19 views

Generating Arrival Counts Given Time

I'm looking to generate arrival counts given a length of time for a Poisson process. This is similar to another question, however rather than generate the particular arrivals, I'd like to just get the ...
0
votes
1answer
38 views

Required sample size to reach adequate power of a test

We got two types of treatment (type 1 and type 2). In our opinion, type 2 treatment has a higher performance and we would like to show this with research. We assume that type 1 treatment has a maximum ...
2
votes
0answers
68 views

An efficient way to generate multivariate normal distribution by Gibbs sampler? [closed]

When learning Gibbs sampler, the most used example is bivariate normal. But what if we want to simulate multivariate normal distribution? The computation (mean and variance) of conditional ...
3
votes
0answers
27 views

antagonistic simulated annealing

Simulated annealing aims at a series of target distributions $$\pi_T(x)\propto\exp\{T\,H(x)\}$$ to find the maximum of the function $H$ and its argument $$\arg_x\max_{x\in \mathfrak X} H(x)$$ if the ...
1
vote
1answer
37 views

How to simulate AR(p) model with trend

Backgrounds I have a time series, and I fitted an AR(p) model with trend of $t^2$, with the help of auto.arima, in R package <...
3
votes
1answer
91 views

How does the inverse transform method work in discrete r.v.?

In this question How does the inverse transform method work? it's mentioned the general procedure to generate r.v. U <- runif(1e6) X <- qnorm(U) X How ...
0
votes
0answers
144 views

Simulate data that arise from mediation with specified conditions

I am looking to create a function that simulates data arising from a mediation process, where a predictor (X) has an indirect effect on the outcome (Y) through the mediator (M). I consulted the ...
1
vote
2answers
318 views

importance sampling from posterior distribution in R

Today I read that Importance Sampling can be used to draw posterior distribution samples just like Rejection Sampling. However, my understanding of Importance Sampling is that its main purpose is to ...
1
vote
1answer
23 views

Random draw from a linear model

I'm building an individual-based model where one component includes increasing winter temperature over time (years). For each iteration of the model (say 1000 iterations that have 25 years each) I ...
0
votes
2answers
33 views

How to simulate, if a customer will buy

If customer 1 will buy a product with a probability of 0.6 and every following customer 0.7, how can I simulate a system with n customers? The result should show which customers bought and which ...
0
votes
0answers
16 views

Simulating data for Spline Regression

I am making some simulation in order to show the performance of the Spline Regression vs other methods like Smoothing Splines, Hodric Prescott filter, etc., I would like to knot if it's better to ...
0
votes
0answers
31 views

Power analysis for ordinal logistic regression (multiple independent variables)

I have a question with regard to a simulation based power analysis for ordinal logistic regression suggested here: https://stats.stackexchange.com/a/22410/231675 (by Greg Snow) The suggested power ...
1
vote
0answers
28 views

Efficiently estimating the area of an unknown number of regions given that one sample is enough to compute the area of a region

(Apologies if the title may sound confusing - I'm not a native English speaker) This problem is a (very coarse) simplification of a research project I've been working on. I hope my attempt at ...
3
votes
1answer
27 views

simulation vine copulas

I am trying to simulate the following structure: $C_{123}(C_{12}(u_1, u_2; \theta_1), u_3; \theta_2)$ I am able to simulate the inner $C_{12}$, I do simply use the method of the conditional copulas. ...
1
vote
0answers
53 views

Poisson vs Gaussian GLM: which to use?

I'm going to provide a simulated case. However, the question is of a general nature (see end of the post). Let's suppose we have some data generated in this way: ...
2
votes
1answer
45 views

What property must a RNG have to be used in Monte Carlo simulations?

For example, every cryptographically secure pseudo-random number generator (CSPRNG) is required to satisfy the next-bit test and withstand "state compromise extensions". This makes me wonder what ...
0
votes
0answers
24 views

Simulation of tossing coins in R

If $X$ = # of heads showing when three coins are tossed, find $P(X=1)$, and $E(X)$. Let $(X=1) = Head$, and $(X=0) = Tail$. Say, I want to solve this problem using ...
0
votes
0answers
5 views

Bi-modal coefficient estimates of bootstrapped difference in differences estimate

I'm trying to conduct a sanity check on a really strange result I'm finding. I specified the following difference in differences logistic model in R: $Pass = \beta_{0} + \beta_{1}Attended\times\...
0
votes
0answers
14 views

Simulating a (discretized) Cox process via binomial sampling

Let X be a Cox process (doubly-stochastic Poisson process) with fixed intensity(rate) $\lambda=50$ , and choose some small time interval $dt=0.01$ . Is the proper way to simulate this, by letting Y ...
0
votes
0answers
31 views

How to Determine Appropriate Values for Correlated Uniqueness in SEM Simulation?

I am trying to run a simulation of power/bias for a particular SEM, in which a number of correlated uniquenesses will need to be specified. I know how to determine the appropriate values of the ...
0
votes
0answers
10 views

Multivarite ARCH, which model should I simulate

I am trying to simulate the following model in MATLAB if this helps: I set the k matrix to all 1's and the a matrix is going to be various values. How could I simulate this in MATLAB. I know I ...
0
votes
2answers
49 views

Create simulation to see whether Chi Squared is suitable

I'm wondering about the following The threshold is that the chi-squared distribution should be a good approximation to the chi-squared statistic under the null hypothesis. As the number of ...
1
vote
0answers
17 views

Simulate stationary VAR(p)

I would like to simulate a stationary VAR(p) coefficient matrix. However, I only found the following (inefficient) solution: Simulate a coefficient matrix (n x n*p) drawing each coefficient from a ...
0
votes
0answers
27 views

How to test whether a random variable is well simulated

Suppose I write my version of ‘rnorm’ function,then I generate 10000 numbers by this function.So,how to test whether this random variable is well simulated? I guess that ‘ecdf’ then ‘plot’ would be ...
2
votes
0answers
12 views

Visualization of unbiasedness of high dimensional paramter estimates

Assume a statistical model $f_{\theta}(X)$ that allows to estimate a parameter vector $\hat{\theta}\in \mathbb{R}^p$ from data $X$ and assume that $p$ is high dimensional (you may assume something ...