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
14 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
21 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
25 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
13 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
37 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
38 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
22 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
24 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
7 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
35 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
14 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
26 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
10 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 ...
1
vote
1answer
25 views

Power analysis for multilevel model with two fixed and two random (crossed) effects: how to define sample size with simr package [closed]

I want to define the sample size for a repeated measurement experiment. Every subject will indicate her/his behavior on a 1-7 scale for several stimuli (=behavior). I expect that personality and ...
2
votes
0answers
28 views

Efficient simulation for distribution of time until coin toss pattern

Suppose we flip a biased coin (with probability $p$ being Heads) repeatedly until a certain pattern (e.g., HHHTT) appears. We are interested in the number of flips $N$ required. It is well-known that $...
0
votes
0answers
14 views

Can simulation batches be treated like individual observations?

(This is one of those cases where I'm sure the answer is lurking somewhere but I don't know the correct terminology to find it.) Sometimes with complex simulations it is intuitively necessary to ...
0
votes
0answers
11 views

Kernel Density Estimation of Hazard rate using R

How can we estimate the hazard rate using Kernel density estimation? For the time being I am simulating 1000 observations from exponential distribution, then estimate its hazard rate using gaussian ...
4
votes
1answer
57 views

Simulate longitudinal, curvilinear, convergent data in R

I would like to simulate data that is similar to a few given observations of longitudinal data (28 measurements per unit) in two groups (see below). The distribution of initial values could be normal ...
1
vote
2answers
20 views

Describing the spread of outcomes from simulations

In general, what is the term to describe the 5th and 95th percentiles of outcomes coming from a simulation study? Say we obtain a vector of outcomes y. In R we can ...
0
votes
0answers
14 views

How to develop a score with training and testing set (with R)

I would like to build a score with data that have the following characteristics: There are much more controls than case there are several variable with more or less differences between the 2 groups ...
1
vote
2answers
43 views

Comparing the mean of MSE for two models

I've estimated 2 models on simulated data and basically replicate the estimations 100 times. What I want to see is if the models are actually different in terms of their MSE. What I've done is to keep ...
0
votes
0answers
25 views

Simulating from an Epanechnikov kernel density estimate in MATLAB / exact form of the Epanechnikov kernel in MATLAB?

It's my first time posting, so apologies if I'm breaking any etiquette. I've used MATLAB's ksdensity function to estimate a density using the Epanechnikov kernel and would now like to make repeated ...
8
votes
2answers
156 views

How can I compare models without fitting?

Regression and machine learning are used in the natural sciences to test hypotheses, estimate parameters, and make predictions by fitting models to data. However, when I have an a priori model, I don'...
1
vote
0answers
37 views

How to get the right correlation matrix for correlated binary data [closed]

I am trying to generate correlated binary data in high dimensional in R using bindata lib given marginal probabilites and correlation matrix, but it give me always error ...
0
votes
0answers
6 views

How initial condition biasing can be eleminated?

I read this book called "Simulation and Modeling" and at the end of last chapter of "Analysis of Simulation Output" asked reader about how we can eliminate initial condition biasing as a trick ...
9
votes
2answers
279 views

Using ARMA-GARCH models to simulate foreign exchange prices

I've fitted an ARIMA(1,1,1)-GARCH(1,1) model to the time series of AUD/USD exchange rate log prices sampled at one-minute intervals over the course of several years, giving me over two million data ...
0
votes
1answer
44 views

Simulate from a mixture of two beta distribution [closed]

I have this distribution : $X \sim 0.75\mathcal{B}e(\alpha_{X_1}=1,\beta_{X_1}=3)+0.25\mathcal{B}e(\alpha_{X_2}=5,\beta_{X_2}=1.75)$ where the density function is given from this function: ...
5
votes
0answers
48 views

Generating fractional Brownian motion in R [closed]

I was trying to generate fractional Brownian motion in R using fbm of the package somebm. However, in this package, I can not ...
0
votes
0answers
10 views

Determine input array that approximates a target output array from complex numerical simulation?

I believe the following problem is ideally suited to a machine intelligence approach, but am unsure where to start. I've used scikit-learn previously with downloaded datasets, but the following seems ...
0
votes
1answer
18 views

Survival event simulation with time-varying confounders and treatment-confounder feedback

I'm trying to generate survival data that contain time-varying treatment and time-varying confounding. The goal is to test inverse probability of treatment method developed by Hernan and James Robins. ...
0
votes
0answers
6 views

Should I use full models when using Powersim?

I tried using powersim from R package simr to estimate the number of participants that I need for an experiment. I performed the simulation based on the data from my pilot study. The model I used is ...
4
votes
3answers
208 views

Conditional distribution of $\exp(-|x|-|y|-a \cdot |x-y|)$

I am trying to use Gibbs sampling or Metropolis-Hastings to draw samples from the joint distribution$$f(x,y)\propto\exp(-|x|-|y|-a \cdot |x-y|)$$ For this I need the conditional distributions of $x$ ...
1
vote
2answers
30 views

Simulating optional stopping in data collection with respect to p values

In null-hypothesis significance testing, if we were to optionally stop data collection every so often and check the p value on the data, the null hypothesis may be eventually be rejected even when it ...
0
votes
0answers
14 views

Best way to measure treatment effect across two treatments

I have two sets of patient-level data for two distinct treatments, unfortunately, the data is only over a 14 week period and I'm hoping to build a predictive model to estimate/simulate what the data ...
1
vote
0answers
25 views

sampling mechanism for correlated variables [closed]

Assuming Y=f(x1,..,Xn), while doing Monte Carlo simulation, I need to sample x1, ..xn based ...
0
votes
1answer
25 views

R code not working as it should? [closed]

I wanted to show computationally that if $2$ poker players are playing heads-up (1 vs. 1) and going all-in on coin flips, then a player with $X\%$ of the chips would win $X\%$ of the time. However ...
4
votes
1answer
418 views

Why we do not accept the result of our simulation study as evidence of a limitation of one method

I am doing a mixture model. I have established a new method using EM-algorithm. I have simulated data from a mixture model. Then, I applied my new method to the data. The result is very satisfying. ...
2
votes
1answer
39 views

First passage time distribution via Monte Carlo simulation

The problem: I want to assess the first passage time distribution via Monte Carlo Simulation, where the first passage time is defined as: $$\tau=\inf\left\{t: X_t > l\right\}$$ where $l$ is the ...
2
votes
1answer
40 views

Error of Bias-Corrected Kurtosis Estimators

Background I've found two different bias-corrected estimators for the kurtosis. The first one is used in various software packages, such as MATLAB, and is called bias-corrected in the respective ...
0
votes
0answers
12 views

How to calculate the mean of a sub sample, given the mean of the super sample and the standard deviation of the population?

I need to run a simulation of cash flows for a project. We are selling a service. The service comes with a range of options. Depending on the specific options chosen, the cost of the service can ...
0
votes
0answers
21 views

Experimental design for simulation experiment

I'm interested in investigating the effect of a treatment on survival times of a patient. The "patient" is a complex program with many interacting categorical and continuous variables. It also has a ...
0
votes
1answer
29 views

How can I make simulated logistic regression model more noisy?

When I want to simulate Y coming from the linear regression model, $$Y_i = X_i ^T \beta + \epsilon_i,$$ I can use code like: ...
0
votes
0answers
12 views

Combining Results of Simulation Replications (Random-Intercept Logit Models under Confounding)

I've written some simulation code in R to learn about the behavior of a random-intercepts logit model under varying degrees of confounding. The simulated scenario is three points in time, two groups, ...
0
votes
1answer
31 views

G*Power and simulation produce very different sample size estimates for a Poisson regression

I've been attempting to conduct a sample size calculation for a Poisson regression. G*Power produced a sample size of 472. Parameters for G*Power Tails = 2 Exp(B1) = 1.233 alpha = 0.05 Power = 0....
1
vote
0answers
34 views

Simulating survival meta-analysis data (with a random effect) [closed]

I would like to simulate survival meta-analysis in clinical trials on R but I'm not pretty sure of what would be the best way to do it and what would be fitting more the reality. The data would ...
0
votes
2answers
52 views

Bayesian- If I only have prior distribution, is there a way to calculate posterior distribution? [closed]

I have a question about Bayesian inference. In my research, I have only a normal prior distribution with known parameters (mean and std.). I do not have a likelihood function, but I need to calculate ...
0
votes
0answers
62 views

Simulating noise around future known data points

I am creating a simulation model of an electricity market. One of the important characteristics is fuel price. Whilst I would like to set the future fuel price, I would like to sample from a ...
1
vote
1answer
31 views

Bayes inference: hypothesis testing on the average parameter

Bayesian inference field: given a dataset, if I assume a normal a priori distribution on the average parameter with zero mean and a given variance, those hypothesis tests can be carried out on the ...