Questions tagged [simulation]

A vast area which includes generating results from computer models.

Filter by
Sorted by
Tagged with
1 vote
1 answer
27 views

Modelling losses in insurance - why nobody seems to talk about left-truncated distribution?

In the (re)insurance field, it is quite common to simulate losses via a Monte Carlo approach and a stochastic generator of both frequency and severity individually (independency between both being ...
1 vote
1 answer
34 views

Choosing a proposal density g(x) for $ f(x)= {\Large \frac{e^{x}}{(e-1)} }$ [closed]

In finding an proposal distribution function $g(x)$ for the following function: $ f(x)= {\Large \frac{e^{x}}{(e-1)} }$ where $0 \leq x \leq 1$ Tested with $$x^2+1, 1/x+1$$ and other variations, but ...
1 vote
1 answer
47 views

Simulating AR(2) Process With Initial Conditions

Consider a system process given by $$x_t = -0.9x_{t-2} + w_t, \hspace{2mm} t=1,\dots n$$ where $x_0 \sim N(0,\sigma^2_0), x_{-1} \sim N(0,\sigma_1^2)$, and $w_t$ is Gaussian white noise with variance $...
  • 249
1 vote
1 answer
49 views

Failing to recover correlation parameter from a linear fixed effects model with correlated errors simulation

I am trying to simulate some data from a linear fixed effects model with correlated errors. The model is quite simple, inspired in a pre-post study. $$Y_i|X_i=x_i\sim N(x_i\beta,\Sigma_i)$$ where $Y_i=...
0 votes
0 answers
14 views

simulation in r [closed]

I am trying to simulate this game: " There are 30 cards , 10 yellow , 10 red and ten blue . The player choose randomly a card , if this one is yellow earn 1 euro , if is red he losses 2 euros and ...
0 votes
0 answers
33 views

How to simulate data from the model $\eta_{i t}=\beta_0+\beta_1 t / 10$ for $Cov(\eta_{i})$, R= correlation of $Cov(\eta_i)$ $i$ is the subject? [closed]

We assume that each $X_i=\left(x_{i 1}, \ldots, x_{i, 10}\right)^{\prime}$ is generated from a distribution with mean $(0 \cdot 1,0 \cdot 2, \ldots, 1 \cdot 0)^{\prime}$ and finite covariance. $\eta_{...
0 votes
0 answers
28 views

The principal submatrix of projection matrix with Gaussian design

I've come across a phenomenon from a simulation that I'm very curious about. But I don't know how to start my analysis. So, I am asking for some guidance. Thanks! Denote by $\mathbf{H}$ the principal ...
  • 95
2 votes
0 answers
33 views

Resampling to handle class imbalance in logistic regression [duplicate]

I was wondering if anyone could help me understand resampling for class imbalance. From what I have learned, class imbalance is usually a small data problem where the less prevalent class usually ...
8 votes
1 answer
109 views

Why does somebody argue that the number of bootstrap replications should not be a multiple of 10?

At a recent conference somebody claimed that the size of the bootstrap replications should always be 999 rather than 1000. Which argument supports this claim?
  • 289
2 votes
1 answer
87 views

What does it mean to have a "transient state" or a "transient phase" in an Ising model?

I downloaded a simple implementation of the Ising model in C# from this link. I have understood more or less the entire code except the following routine: ...
  • 1,530
0 votes
0 answers
8 views

Simulate ERGM with nodal attributes

I'm not entirely sure where to post it, here, or on Stack Overflow. I'm trying to simulate an ERGM that has nodal attributes. I'm using the statnet ...
  • 117
0 votes
0 answers
5 views

Unified Efficient Sampling from MultiIndex Without Replacement?

I have a tensor of arbitrarily high rank $P$, indexed by $(i_1,i_2,\ldots,i_P)\in \{1,\ldots,N\}^P$. I would like to randomly elements $K$ elements from this tensor without replacement. If the tensor ...
  • 2,271
1 vote
0 answers
28 views

Recreating Time Series by Simulating ARMA-GARCH Process + Fitted Residuals, using rugarch package in R

I was trying to use rugarch to fit an ARMA(1,1)-GARCH(1,1) model to the log-returns of the S&P500, extract the standardized residuals, and use them to simulate ...
  • 11
0 votes
0 answers
22 views

Iteratively modifying parameter space for agent-based models to find rare outcomes - existing techniques?

I want to do something that feels very straightforward but I'm sure there are existing techniques, I just don't know what they are. MWE: I am running simulations using an agent-based model (stochastic,...
  • 125
2 votes
1 answer
43 views

How to simulate artifical data for multinomial regression? [duplicate]

I want to use some predictors (for example, $x_1$ and $x_2$ below) to simulate the multinomial outcome (for example, with 3 levels). Below are the codes I found in another question regarding ...
0 votes
1 answer
34 views

How does one test the efficiency and completeness of an estimator using monte-carlo simulation?

How does one test the efficiency and completeness of an estimator using monte-carlo simulation? In particular, I want to use-montecarlo simuation to answer. Maybe the better question is how does one ...
1 vote
3 answers
33 views

Compare single observed value to simulated distribution

I have a distribution of values that I have simulated for a null hypothesis data generating process. I have a single real-world observation that is wayyyy outside the percentiles of this distribution. ...
  • 31
16 votes
2 answers
911 views

Why does this algorithm generate a standard normal distribution?

I have this algorithm which I encountered: (1) Generate $U_1$, $U_2$ independently from Uniform(0,1) (2) Set $Y_1 = -\log{U_1}, Y_2 = -\log{U_2}$. If $Y_2 > \frac{(1-Y_1)^2}{2}$, accept $(Y_1, Y_2)$...
  • 163
0 votes
0 answers
49 views

How to do power analysis in R for one-sample binomial test?

I want to test the hypothesis that an event occurs significantly less often than in 7% of the cases: H0: p = 0.07 H1: p < 0.07 I assume that the true proportion of the occurrence of the event is 3%....
  • 1
0 votes
0 answers
14 views

Getting "posterior" distribution from non-bayesian regression

Suppose the true model for a random variable is of the form . Now, if I run a regression and get my fitted values and estimated coefficients, how should I estimate the CDF or the quantiles of the ...
0 votes
0 answers
13 views

Is there a formula for estimating confidence intervals for indirect inference estimates?

Indirect inference is usually deployed to estimate parameters $\theta$ of simulation models, i.e. models for which likelihood is unknown or intractable but that can be "run forward" ...
  • 1,288
0 votes
1 answer
36 views

predict probability of hotel booking incorporating length of stay - ideally daily

Let us say I have daily room booking data over time. Rooms have features X like aircon, number of sleeps/person. Rooms can be booked for a number of nights (NONs) between 1 and 7. They also have a ...
  • 1,346
2 votes
1 answer
73 views

Compute conditional probability for Poisson binomial distribution

Consider $X=Y_{1}+\cdots+Y_{n}$, where $Y_{1}, \cdots, Y_{n}$ are $\mathrm{n}$ independent Bernoulli random variables with $Y_i\sim Bernoulli (1,p_i)$, $i=1,2,\cdots,n$. Then $X$ has a so-called ...
0 votes
0 answers
11 views

Recover parameters from dual-route model with mixture model

Here, I present to you data that were simulated with a dual-route model. I tried to recover the parameters used for data simulation with a) the identical dual-route model and b) a mixture model, but ...
  • 33
1 vote
0 answers
19 views

How to compare different sections of a time series with each other?

I am analyzing time series showing the average delay of vehicles based on simulation time in traffic microsimulation. 5 simulation runs were performed, so there are 5 time series in the figure. I ...
1 vote
1 answer
29 views

How to generate variables with common latent factor?

I'm dealing with Kalnins (2018) work about multicollinearity. I can't comprehend one thing - how can I get variables that share a common latent factor? (not only correlate with each other). I can ...
1 vote
0 answers
19 views

Simulating Statistics from Regression Output

Hi I am looking at the case where I have estimated a simple regression model like so: $$ y_{i} = \beta_{0} + \beta_{1} \times T + \epsilon_{i} $$ I assume that $T\in \{0,1\}$, think of a binary ...
  • 191
0 votes
1 answer
27 views

Power calculation by simulation - what do I do with model failures?

I'm trying to run a power calculation by simulation on a set of exponential decay datasets using the nlme package in R. Here's the process: Simulate a bunch of exponentials, using some conservative ...
  • 11
0 votes
1 answer
45 views

Simulating Survival Times and Accounting for Population Mean Linear Predictor?

I have been using the methods outlined in: Bender, Ralf, Thomas Augustin, and Maria Blettner, "Generating survival times to simulate Cox proportional hazards models," Statist. Med. 24: 1713–...
7 votes
2 answers
462 views

Simulation to estimate a conditional expectation

Let X and Y be independent and identical exponential random variables with parameter $\theta>0$. Compute $P[X \leq x | X+Y]$ for $x\geq0$. I tried to solve this theoretically here (https://math....
  • 81
0 votes
0 answers
27 views

Simulating from VECM to VAR in statsmodels

I need to simulate from a VECM in Python. My VECM doesn't have constants nor linear trends (this holds true for both inside and outside the cointegration matrix). However, the statsmodels VECM doesn't ...
  • 595
0 votes
0 answers
18 views

Do $X_i-Y_{im}$ and $X_i-Y_{i}$ have the same distribution?

I'm working on a problem in which I need to simulate the distribution of $X_i-Y_{im}$, where $m$ denotes location, and $i$ denotes individual. $X_i$ and $Y_{im}$ are independent. If I need to simulate ...
  • 1,898
1 vote
0 answers
65 views

How to derive g-computation for a longitudinal experiment from sequential conditional exchangeability?

We have a longitudinal experiment, with interventions $\bar{A}=\{A_1,A_2,\ldots,A_K\}$ and outcomes $\bar{Y}=\{Y_1,Y_2,\ldots,Y_K\}$. Using some sequential conditional exchangeability assumptions, it ...
  • 366
9 votes
2 answers
709 views

How to simulate the St. Petersburg paradox

I am trying to find the expected value of the game in the St. Petersburg paradox. The game has infinite expected value, but in my simulation the payouts are about 15 on average, which is way too small....
  • 93
0 votes
0 answers
11 views

Bus simulation: choosing a number of iterations (confidence interval?)

I programmed a simulation of a single bus transportation link (one origin, one destination) and I'm trying to calculate an optimal headway for this service. For each hourly slot I know how many ...
  • 1
3 votes
1 answer
93 views

Why is my simulated Poisson regression mean not equal to the variance?

I simulated a simple poisson regression model as follows $x \sim Normal(2, 1)$ $\mu = \exp(0.6 + 0.9 x)$ $y \sim \text{Poisson}(\mu)$ ...
0 votes
2 answers
50 views

Random data generation for hurdle model using R [closed]

I would like to generate random data for a distribution which takes the form of hurdle-like model. Let's denote a random variable X with probability mass function \begin{align} Pr(X=0)&=\alpha\\ ...
  • 312
0 votes
0 answers
30 views

Comparing time series classification with Hidden Markov Model vs Dynamic Time Warping - which model should I use to generate data?

Copy of this question on DataScience SE I am writing a thesis which compares two approaches to time series classification: Hidden Markov Models and Dynamic Time Warping combined with 1-NN. I'll apply ...
0 votes
1 answer
23 views

Why do I get the exact same matrix when changing the correlation?

I'm trying to create artificial correlated data using the genCorData function, in the simstudy package. I'm running the following in R: ...
  • 151
1 vote
1 answer
73 views

How to ge the Monte Carlo standard deviation of the empirical standard deviation?

The authors get the Monte Carlo standard deviation of the empirical standard deviation as follows. My question is how to get the MCSE of the EmpSE? For bias, the MCSE of $\frac{1}{n}\sum \hat{\theta}...
  • 432
1 vote
1 answer
25 views

How to perform a fair simulation study?

Say I want to compare three methods in a simulation study. Let’s say I want to compare the lasso, the group lasso, and a neural network at selecting relevant variables. In terms of validation metrics, ...
  • 13
2 votes
1 answer
50 views

How to verify the convergence rate in Monte Carlo simulation?

Given a iid random samples $X\sim N(\theta,1)$, we have a unknown parameter $\theta$ and its estimator $T_n=T_n(X_1,\dots,X_n)$. If we have strictly proved that the convergence rate is $$ |T_n-\theta|...
  • 432
1 vote
0 answers
47 views

Why is my 95% CI from a simulation being either 100% or 0%?

So what I intended doing with the code is to simulate dataset with the outcome being number of parasites that died (yi) out of every n=50 parasites on the host. There are 2 treatment groups (control ...
  • 11
3 votes
1 answer
65 views

Can I say that $T_n$ is a consistent estimator of $\theta$ by Monte Carlo simulation under this setting?

Given a iid random samples $X\sim N(\theta,1)$, we have a unknown parameter $\theta$ and its estimator $T_n=T_n(X_1,\dots,X_n)$. If we have strictly proved that $T_n$ is a consistent estimator, can ...
  • 432
3 votes
1 answer
48 views

Generate a truncated lognormal distribution given mean, variance, lower bound and upper bound?

Basically, I would like to generate a sample of truncated lognormal distribution given mean, variance, lower bound and upper bound. Note that the mean and variance here are the mean and variance of ...
3 votes
1 answer
328 views

Drawing from the joint distribution by drawing from the marginal and conditional distribution

How can we prove that a draw $(x,y)$ from the joint probability distribution of two random variables $X$ and $Y$ can be obtained by first generating a draw $x$ from the marginal probability ...
  • 2,350
0 votes
0 answers
21 views

Correlation of groups in simulating data

I am simulating time series data. Each simulation consists of a group of time series with nodes at lets say 3 levels. To get the data to adhere to the structure I only generate the terminal units (...
2 votes
1 answer
31 views

No Variance in Monte Carlo Simulation

I wanted to do a Monte Carlo simulation for some of the electoral districts in my state in the upcoming US midterms. My methodology essentially was as follows: I have a list of populations and vote ...
  • 123
3 votes
1 answer
32 views

Comparing power between models: how to set a fixed effect size in glm?

I am trying to understand how much power we lose by selecting a categorical exposure versus a continuous exposure in a generalised linear model (GLM). I didn't have problems calculating power using ...
  • 31
0 votes
0 answers
14 views

How can calculate asymptotic distribution of unit root test

I want to calculate KSS table critical values using the functional of a Brownian motion W. I use the following codes. But I think I'm making a mistake somewhere. I would be glad if you help.. For ...
  • 3

1
2 3 4 5
36