Questions tagged [simulation]

A vast area which includes generating results from computer models.

1,696 questions
Filter by
Sorted by
Tagged with
3 views

Simulating data which is like another data X

I have faced a problem in my work where I am required to simulate data like another data say X which has many variables. Now, if it were only one variable, I would have probably just drawn some random ...
• 1,030
9 views

how to generate data from beta-Liouville distribution?

I want to test my model following the beta liouville distribution, so as a synthetic data, I need generate data from this distribution. can anyone mathematically tell me how to calculate it? this is ...
6 views

Can you generate correlated ARMA time series with different lag orders?

Is it possible to generate correlated ARMA time series when the ARMA models are different? For example, can you generate two time series which are correlated when one is an AR(5) model and one is an ...
1 vote
31 views

Non-positive definite matrix problem for desired correlation structure

I want to derive a correlation matrix such that block1 is 0.1 within itself, block2 is 0.1 within itself and 0.7 with block1, and the remaining variables are 0.01 within itself and with other blocks ...
33 views

pointwise envelopes not including Theoretical line Foxall J

I am computing pointwise envelopes for the Foxall's J function to investigate the whether some point patterns of interest are clustered, avoid or are independent from other point patterns or polygons. ...
• 245
46 views

Logistic regression simulation with respect to event occurrence (prevalence)

I am trying to simulate logistic regression data, but under the constraints of prevalence. $$\text{logit}(y_i) = \beta_0 + \beta_1 X_1 + \beta_2X_2$$ For example, I want to create a dataset that has ...
• 111
137 views

Simulating a joint distribution with the inverse method

I have the following joint distribution: $$f(x, y) = 3x^2y^xe^{-x^3}(1 + x),\quad x \gt 0,\ y \in (0,1).$$ I want to simulate a sample of this distribution through the inverse method but I don't know ...
• 75
37 views

Distribution of the Spearman rank correlation coefficient under the assumption of non-zero correlation

There are some papers and some R packages providing exact calculations for the CDF and the inverse-CDF of the (sample) Spearman rank correlation coefficient. My question is: How difficult would it be ...
• 649
1 vote
12 views

Non anticipative sampling an ARIMA(1,1,0) process with known terminal value

I have an $\mathrm{ARIMA}(1,1,0)$ process $X_t$, for which I know the values $X_0=a$ and $X_T=b$. I want to sample paths $(X_t)_{t=1..(T-1)}$ consistent with the boundary conditions. One way to do it ...
• 185
1 vote
61 views

What's the transition probability according to this PDE?

I'm trying to figure out how I can simulate markov chains based on an ODE: dN/dt = alpha N (1 - N / K) - beta N Thus N denotes ...
• 113
1 vote
29 views

How to use the function rsimsum in R to do a simulation of a hypothesis test?

I try to use the function rsimsum in R to do a simulation of a hypothesis test and report the Monte Carlo standard error of the power. Assume that iid random sample ...
• 262
65 views

Suppose $X$ and $Y$ have joint pdf $f(x,y) = 0.5,$ for $0 \le x \le 1;$ $0\le y\le2.$ Evaluate $P (Y >X).$

Kind of lost where to start with this. Could be easy but I don't know where to start simply by knowing $f(x, y) = 0.5.$ How can I find the probability $P(Y > X).$
1 vote
46 views

How to simulate non-gaussian stochastic paths

(Edited to be clearer) I am trying to replicate simulating Geometric Brownian Motion (GBM) but instead of the stochastic increment following a normal distribution, I would like it to follow a ...
• 13
122 views

Sample uniformly from unit square conditioned on sum and product

Consider the following conditional distributions: \begin{align} X, Y \stackrel{\text{iid}}{\sim} U(0, 1) &\mid X + Y = a & a \in [0, 2] \\ X, Y \stackrel{\text{iid}}{\sim} U(0, 1) &\mid X ...
• 913
53 views

Reproduce chi-square p-value via simulation

I have a 3-sided (fair) die with sides x1, x2, x3. I roll the die 3000 times and tally the results: x1 * 990, x2 * 1050, x3 * 960. A quick chi-square test reveals that the probability of getting this ...
• 123
45 views

Solving for the parameter of an exponential distribution

Suppose I have a random variable $X$ where $X$ follows an exponential distribution of the following form: $$f_X(x) = \frac{1}{\lambda}e^{-\frac{x}{\lambda}}$$. I want to find the value of $\lambda$ ...
19 views

Identify name of sampling / simulation strategy

From what I've learned, it seems like in order to simulate draws from a distribution $X \sim p(X)$ one can take advantage of the fact that $p(X) = \int p(X, z)p(z)dz$ and use the following strategy: ...
79 views

How to sample from a custom heavy tailed (e.g. custom Cauchy) distribution?

I would like to draw samples from a distribution with pdf $z \mapsto \frac{1}{1 + |z|^\gamma}$ ($z \in \mathbb{R}, \gamma > 1$). Notice, that for $\gamma = 2$, this is proportional to the standard ...
• 233
26 views

Communicating probabilistic information through a forecasting service

Imagine that we were to build a forecasting service for a public transportation company. For a given set of passenger terminals $V$ scattered across a region, the forecasting service predicts the the ...
25 views

Simulate Arrival Time for Scheduled Appointments

I'm trying to build a simulation of a healthcare center. The appointment times are scheduled every 30 minutes. However, some patients arrive later than their appointment and some might arrive early. ...
25 views

Inverse transform sampling : comparing bias, variance and mse for an estimator

Starting from the PDF of the Pareto distribution, f_{\theta_1, \theta_2}(x) = \begin{cases} \frac{\theta_1 \theta_2^{\theta_1}}{x^{\theta_1 + 1}}, &\quad x \geq \theta_2 \...
1 vote
23 views

Generate a syntetic log-normal two dimensional random field

I would like to test some functions that I wrote related to the kriging applied to rain data. In order to do that, I would like to generate a synthetic log-normal 2D random field. The idea is to ...
• 111
1 vote
57 views

Recalculate fitted values/Simulate of an Arima model with different xreg values

I have about 100 ARIMA models, where each models the demand of a separate household using the temperature as an exogenous value. I've used the auto.arima from the ...
30 views

Alternative to SimPy for continuous event simulation?

The python library, SimPy, is pretty explicit that it only handles discrete event simulation. Though it is theoretically possible to do continuous simulations with SimPy, it has no features that help ...
• 1,700
1 vote
31 views

How to validate the decomposed distributions?

I am fitting distributions for the time spent for three processes (i.e., pick up tools, walk to destination, install) in a system that I am trying to simulate where the original data for these ...
• 11
9 views

Should I remove 0 values when calculating the average of many simulation runs?

Let's say I have a simulation model with stages A, B, C. I want to calculate the average time of each stage over 1000 runs as they contain stochastics. In many runs, either one of these stages may not ...
• 125
8 views

Comparison of two methods which use confidence interval for testing

I have a parameter, which I want to test whether it is different from 0 or not. Using a sample, instead of using p-value, I have constructed two confidence intervals, say CI 1 and CI 2 based on two ...
• 789
23 views

How to estimate/simulate sample size based on glmm?

I would like to estimate the minimum required sample size in R to detect an effect size I found in a recent study. The simulation should be based on an already calculated mixed effects glmm with a ...
112 views

How to simulate data of a random intercept effect model in R?

I want to simulate data of the following random intercept effect model in R $$Y_{ij}=\alpha+\beta x_{ij}+u_{0,i}+\epsilon_{ij}$$ $$u_{0,i} \sim N(0,\tau^2)$$ $$\epsilon_{ij} \sim N(0,\sigma^2)$$ Here ...
• 419
1 vote
75 views

Simulating Horseshoe Distribution

Can someone check whether I correctly simulate the Horseshoe pdf? ...
• 300
9 views

Application of Time reversibility property of stochastic processes

Are there any theoretical or applied consequences of a stochastic process being time reversible? I know a Markov chain being time-reversible implies the existence of a stationary distribution. But in ...
• 101
38 views

Simulated DHARMa residuals, how are they created?

I am currently working with the DHARMa package and I was looking at the explanations of how the residuals are simulated (https://cran.r-project.org/web/packages/DHARMa/vignettes/DHARMa.html): ...
• 23
22 views

simulating linear model with INLA

I was looking at INLA's website and they test a linear model at this page: https://www.r-inla.org/download-install. ...
• 1,021
1 vote
9 views

Generating Autoregressive x(m) Terms in R [closed]

Attempting to create code that generates x1...xm values, time series plot, and autocorrelogram given certain coefficients and white noise. Code built so far: ...
47 views

How can I generate truncated normal draws from truncated standard normal draws?

Some random variables are transformations of a standard normal. For example, a draw from a normal density with mean $b$ and variance $s^2$ is obtained as$$e = b + s\epsilon$$ where $\epsilon$ is a ...
• 473
52 views

What is the distribution of a Cholesky transformed variable?

I have a situation where I have a vector $\textbf{x} \sim N(\mu_x, \sigma^2_x)$ and a vector $\textbf{y} \sim N(\mu_y, \sigma^2_y)$. I want to generate a new $\textbf{y}_2$ that transforms $\textbf{y}$...
• 219
16 views

Resample observations to achieve a specific correlation

I have a dataset of (people and their wealth) and (restaurants and their price). I want to resample this data (with replacement) such that there is a specific correlation between ...
• 219
11 views

coefficients for small effects in a binomial simulation

Im trying to simulate a binomial linear model, where a binary output is predicted from a three level categorical variable. Supposing that 1.In the base level, the event has a small (.15) probability ...
1 vote
60 views

Simulate normal data for different covariates with specified means and variances [closed]

I'd like to simulate, say 1000 cases, normal data (from normal distribution). For only one covariate (e.g., gender), the male group is from N(0,sd=1) and the female group is from N(1,sd=2), I can ...
11 views

What are good options for deriving probability distributions of transition matrices when data lacks the memoryless property of a Markov chain?

I have a dataset which I initially believed was suitable for running Markov chain simulations, in that there is a finite number of readily identifiable states that all population elements fall into ...
1 vote
67 views

Bootstrap BCa Quantiles of the quantile function

Let's say I have a vector $x$ on $n=250,$ (in R) x = rnorm(250) The quantile of $\alpha=0.01$ is : ...
32 views

Create a time series with a known autocorrelation in R

I would like to create a time series in R that is going to have a known auto correlation. I tried creating two correlated variables and then parsing the time series (as shown below) but when i run <...
• 207
1 vote
18 views

Get Yule Walker estimates from autocorrelations

I'm looking to be able to estimate parameters of an AR(2) time series using the sample autocovariances. I have: ...
1 vote
30 views

Logistic regression of 'true model' has bias

I'm trying to train a logistic regression on simulated data. I have n=1000 simulations for the following variables: binary proxy variable proxy = rbinom(n, 1, 0.5) ...
1 vote
21 views

Converting fair draws from a PDF into draws from a PDF with a reduced dimensionality

Suppose I have N fair samples $(x_i, y_i); 1 \leq i \leq N$ drawn from the 2 dimensional continuous PDF $p(x, y)$; $\int p(x, y) \, dx dy = 1$. The functional form of $p(x, y)$ is unknown. Is there a ...
• 13
1 vote
21 views

Simulating survival times

Using a parametric survival function such as the Weibull, survival times can be simulated using the inverse CDF method $$F(t)=1-exp[-H(t)]$$ $$F(t)=1-exp\Big[-\int_{0}^{t}h(s)\,ds\Big]$$ Is there a ...
7 views

How many seasons to simulate when evaluating effectiveness of a positional role in football tactic?

suppose I want to set up a simulation of football manager matches to determine which positional role is more effective to a particular formation. Let's say Wide Midfielder vs Complete Wing Back. The ...
184 views

How can I sample from a shifted and scaled Student-t distribution with a specified mean and sd in R?

I'm currently building some Bayesian models with the brms package and the default intercept prior is student_t(3, 0, 6.3) and so ...
• 43