# Questions tagged [simulation]

A vast area which includes generating results from computer models.

1,301 questions
Filter by
Sorted by
Tagged with
24 views

### How to simulate predicted probabilities

Can you help me out with the following brain twister? I predict the probability (p) of a sale for each potential customer. On average, p is 0.003. The model mainly gives me p values in the range 0....
19 views

### How to write a function, that calculates moments and likelihood $\theta$ estimates? [closed]

If I have a continuous density function, how can I write a function that gives moment and likelihood parameters' $\theta$ sample estimates in R? The density function is: \begin{equation} f_X(x)= \...
20 views

### I need to construct function that gives out data of specific pdf function and draw histogram of it

So, the given density function is: $\theta x ^{\theta - 1}, \ \ if \ \ 0<x<1 \text{ and } 0 \ \ \text{ otherwise}$. $\theta$ is given as 2. I also need to draw a line that corresponds the ...
7 views

### AR(1) with known initial and terminal condition: how to draw the innovations?

Suppose I have the following stationary $AR(1)$ process: $$y_{t}=\alpha_{0}+\alpha_{1} + u_{t}$$ where $u_{t} \sim \mathbb{N}(0,\sigma^{2})$, with $\sigma^{2}$ known. Suppose I have an initial ...
9 views

### Isn't a simulation a great model for model-based reinforcement learning?

Most reinforcement learning agents are trained in simulated environments. And the goal is often to maximize performance in this same environment. Why is the simulation not used for planning in these ...
16 views

### How to simulate spatial point patterns that have spatial structure similar to that of given spatial point pattern?

I have some spatial point pattern X distributed in polygon wind and I wonder how can I simulate different point patterns that by their spatial properties (for example, number of points, spatial ...
19 views

### Generalised Linear Model - Response error is constant; boundary (singular) fit; leading leading minor of order 4 is not positive definite [closed]

I am trying to run the code below in order to simulate P-values using a generalised linear model (power analysis): ...
46 views

### simulation in r

i have the following data: ...
14 views

### Safety stock calculations using Intermittent Bootstrap

Together with fellow students, I’m working on an assignment to calculate safety stock levels in case of intermittent demand. We’re already able to simulate the demand like in the paper of Willemain, ...
7 views

### Simulation and sample size [closed]

How to make simulation for very large sample size? Stats:Experts believe that social distancing can reduce transmission of COVID-19 by about 60%. If the total COVID-19 cases all over the world are ...
16 views

### Simulate an AR(1) proccess in R [closed]

I want to simulate the model $$\epsilon_t=\rho\epsilon_{t-1}+u_t, t\in\{1,\dotsc,T\}$$ where $u\sim N(0,\sigma_u^2)$, i.i.d., and the initial value starts at $-\infty$, that is, \epsilon_1=\frac{...
56 views

### Wilcoxon Rank Sum Test vs $t$-test Power Simulation

It is well known that the Wilcoxon rank sum test is more powerful for detecting shifts in location when the data is non-normal. However, I am conducting a brief simulation study and my results ...
22 views

### How can I simulate a student-t copula in R based on marginals?

I'm trying to simulate the joint distribution of Brent oil prices and an exchange rate to compare it to the empirical distribution. For this, I have been following this article: http://...
25 views

### Random Sampling from Farlie-Gumbel-Morgenstern bivariate exponential distribution

I would like to obtain an algorithm for generating iid samples from Farlie-Gumbel-Morgenstern bivariate exponential distribution (as described in the book by Johnson and Kotz as Gumbel's Model II ...
46 views

### inverse transform method [closed]

Using Inverse Transform Method to solve parts of the problem below: (a) Suppose $X \sim \text{Exponential}(λ = 0.2)$. Use RN to generate 20 random realisations of $X$ $\{X_1, X_2, .., X_{20}\}$ ...
11 views

### Resampling method to estimate a reasonable sample size

I would like to know if a method I'm using to determine a sample size is reasonable. In the end of each heavy-ion collision simulation, which I'll call an event, my program computes $N$ possible ...
20 views

### Monte Carlo integration estimating identity operator

I have to calculate the estimator of $\theta=\int_{-1}^{1}|x|e^{-x^{2}}I_{\mathbb{R}}(x)dx$ I implemented the following R code, but I am hesitating about the use of the identity operator. Would be ...
20 views

### Simulating with mixture distribution

I have fitted a gaussian mixture distribution to residuals, and now I want to simulate the residuals. However, I want the model to be independent of the time steps(have it as an input to the model). ...
17 views

### Choosing error for a linear regression model when simulating data for a bayesian sample size determination

Background: I am writing a grant and trying to get a sample size estimate for a Bayesian linear regression. I am trying to link a brain measure to a change in a behavioral measure. So the model is ...
33 views

### Running a simulation: replications or bootstrap?

I draw $n$ iid random draws from a univariate Gaussian distribution. My goal is to estimate the density $f$ using a nonparametric density estimation approach. To add a measure of uncertainty, I want ...
26 views

### Simulation from generalized linear model with specific signal to noise ratio

I am trying to simulate from a generalized linear model (GLM) in a specific signal to noise ratio (SNR) setting, but run in to problems if I try to define a reasonable SNR for non-Gaussian data. In ...
15 views

### How to fit a power curve for a glm with simr

My response variable is counts of turtles at sea surface per aerial survey (possible values: 0,1,2) and I use a Poisson distribution for it (since my data are not overdispersed neither zero inflated). ...
42 views

### Maximum likelihood estimation by simulating the probability density function

Let's say i want to fit a certain exotic distribution using maximum likelihood estimation. However, i have no access to the theoretical probability density function to retrieve the likelihood (it is ...
37 views

### How to simulate from a step (simple function) hazard function?

I have a step hazard function $h(t)$ (a simple function that jumps at specific times and it is constant between those jumps). Something like: How can I simulate survival times from this hazard ...
16 views

### Confidence interval of bootstrapped difference of means

I am attempting to calculate a confidence interval for a difference in 2 populations by means of bootstrapping in order to compare this to an interval calculated via normal theory. I am getting stuck ...
40 views

### What is the relationship between Metropolis Hastings and Simulated Annealing?

Context and Problem In the Wikipedia page for Simulated Annealing they state The simulation can be performed either by a solution of kinetic equations for density functions or by using the ...
30 views

### Interpretation of simulation of chi-square distribution?

I created a simulation study of distribution of $n$ values in an $m$-dimensional table under the assumption that the true distribution is uniform. The goal is to find out why we should be careful ...
36 views

### Distribution of the median of an exponential distribution?

Say i have $X_{ij} \sim Exp(\theta)$ for $i=1...n,\;\;j=1...k$. Afterwards I derive $k$ medians for $k$ groups of size $n$ (even number). The median is a random variable say $M_j$. Do we have any ...
12 views

### How to use bivariate distributions [Year i vs. Year i + 1] to simulate a variable over time in R?

The basic thing I am trying to do is model a person's income over time, using copula functions in R. The data that I have is a bunch of person-level data, which tells us someone's age, their income in ...
10 views

### Conditional draws from a multivariate mixture model keeping one variable fixed

I would like to draw samples from a multivariate mixture model, for a given value of one of the variables. Assuming a gaussian mixture distribution built on $P_{1..p}$ variables with $K$ components: ...
428 views

### Does rnorm produce numbers with replacement/without replacement?

rnorm is an R language function defined as: rnorm.X generates multivariate normal random variates in the space X. Consider <...
40 views

### Simulate Lomax distribution

I want to simulate the Lomax / Pareto type 2 distribution from a standard uniform distribution in python. I managed to transform it into a Pareto distribution, but I'm not sure how to transform it ...
39 views

### Simulating multiple comparisons example

I referred to this question, but found no solution to my problem. I want to simulate a simple case of multiple comparison problem, where family-wise alpha error increases. Question 1 First example ...
8 views

I am trying to simulate a list of transactions of the type that would appear on the bank statement, eg ATM visits rent/food payments, salary deposit, etc. For generating random transactions the focus ...
27 views

### Generate from marginal distribution [duplicate]

Reading a text on Transformation and Variate Generation that says that if we want to simulate V, but we know only its conditional distribution given U, and we can simulate U then we can simulate V ...
37 views

### Predicting a Markov chain next state using previously predicted states

Suppose we have a Markov chain with two states A and B. This associated transition matrix is: \begin{equation} P_{mc}= \begin{...
63 views

### Inconsistent result in checking the approximate exactness of Mood’s median test

I am running a simulation study to check the approximate exactness of Mood’s median test with the following R code (using the RVAideMemoire package): ...
14 views

### Incremental updates for percentile estimates [duplicate]

I want to estimate percentile statistics for time-series pairs $(t, y)$ over varying granularities of time (hour, day, month, etc) For example, if I have the following pairs ...
56 views

### Is it necessary to simulate unbiased coin in using frequentist approach for determining if coin is unbiased?

I’m trying to determine the best way to detect if a coin is unbiased, given some desired alpha. I understand basic probability/statistical inferencing, but there’s some information out there that ...
192 views

30 views

### whats the difference between sample and evaluate?

I'm reading a paper from F. 0. Bunnin, Y. Guo and Y. Ren. They state: Therefore we choose the SIR algorithm, a simulation procedure that requires only the ability to evaluate the likelihood ...
34 views

### probabilistic Loss calculation in excel

This is a homework I received to proceed with an application, which is outside of my knowledge. Any help would be very much appreciated. This may not be the right way to ask questions here, my ...
9 views

### Simr power for interaction: how to set the effect size for interactions?

I want to calculate power for an interaction (two categorical variables, each with two levels). I'm using the simr package. I'm able to calculate the observed power, but now I would like to modify the ...
16 views

### Simulation - Discrete Phase Change

I have a question of how best to approach a problem, I hope this isn't too general. The type of process I'm trying to model is described in the table below: We have a process that we're seeking to ...
24 views

### Replicate sample from population using distributions

I would like to replicate a sample from a population. For this, the distribution (PDF) of $n$ characteristics are calculated. Then I just draw at random from each PDF, and put it as part of the new ...
252 views

### Parameter recovery (Gamma distribution and model with a random intercept)

TL:DR version - I am trying to simulate data from a gamma distribution and then fit a Generalized Linear Mixed Model (GLMM) to recover the parameters. The parameter recovery for the fixed effects is ...
9 views

### Is constructing a simulated model for a fixed SNR possible in binary regression?

When studying variable selection techniques like step-wise regression and the LASSO, a few studies employ a signal to ratio measure in order to control the amount of variability in a simulation. ...