Questions tagged [simulation]

A vast area which includes generating results from computer models.

Filter by
Sorted by
Tagged with
0 votes
0 answers
11 views

Simulation using R where aggregated simulated values = total known values [closed]

The dataset I am working with is a county-level aggregate dataset in the US. For counties with small populations (<100) or with <5 observations in a year, the data is suppressed. Since I know ...
bwbennett09's user avatar
0 votes
0 answers
5 views

Stationary Bootstrap Block Size Impact on Portfolio Simulation Results

I'm analyzing simulated portfolios generated using the stationary bootstrap method proposed by Politis et al. (1994). This method is expected to be robust to the choice of average block size, as it ...
pinpss's user avatar
  • 1
0 votes
0 answers
48 views

Post hoc power for multiple logistic regression

I have data frame named "finalend", I conducted multiple logistic regression model named "model" with all predictors as categorical or binomial variables and "TestAnxiety"...
NEA's user avatar
  • 33
0 votes
0 answers
8 views

Assigning variance-covariance matrix in generating artificial data for mixed-effect model

I can’t understand specifying correlation between within-participant conditions when generating artificial data for mixed-effect model regression. It would be grateful if you could help me. My story ...
AKIRA28's user avatar
  • 21
0 votes
0 answers
35 views

When do we not know the distribution of residuals?

In a previous question (How does simulation help validate model assumptions?), I received the following comment: "When a model is too complex such that a derivation of the distribution of the ...
ionojoseph's user avatar
0 votes
0 answers
33 views

How does simulation help validate model assumptions? [closed]

I posted a question here but I think it was too complicated: How does simulation help check if model assumptions are met? I want to re-phrase it: In general, how does simulation help determine if ...
ionojoseph's user avatar
3 votes
1 answer
24 views

How to estimate required sample size for the two-sample Kolmogorov-Smirnov test

I have a simulation model which produces a value for an output variable. Running it many times gives skewed distributions for this output variable. What I'd like to do is compare two distributions, ...
Riley's user avatar
  • 141
0 votes
0 answers
20 views

Specifying random effects for simulation of categorical data

I am simulating data for an experimental design with two conditions. I specified the following multilevel model: $$ y_{ijk} = \beta_0 + u_{0j} + v_{0k} + (\beta_1 + u_{1j} + v_{1k}) * X_1 + e_{ijk} $$ ...
staterdam's user avatar
0 votes
0 answers
13 views

Python/R Implementation of bandwidth selection in univariate KDE [closed]

I am looking for implementation of various univariate bandwidth selectors including rule-of-thumb, plug-in and cross-validation to do a small simulation study. As far as I am aware, there is no r or ...
abalone's user avatar
2 votes
1 answer
60 views

How to show in R, using a simulation, that when sampling from a normal distribution, the sample mean and sample variance are independent

What is the best way to show that when sampling from a normal distribution, the sample mean and sample variance are independent? I know the theory behind this result, I would like to show it using a ...
Carlos233's user avatar
2 votes
1 answer
69 views

Simulate a distribution from a fitted beta-regression model for a density plot in R [duplicate]

I have produced the following figure by simulating some values from a fitted gamma regression with a low AIC value that provides the closest approximation of my raw data out of all of my models, and ...
ElizaBeso000's user avatar
0 votes
0 answers
35 views

Sample size in simulation and stopping criteria

I want to estimate the average of a random variable by simulation. Also, I want to estimate a proportion by simulation. I know that there are formulas to calculate the minimum sample size so that the ...
Vicent's user avatar
  • 799
0 votes
0 answers
27 views

Inference for Binomial proportion with estimated p but unknown N

Let's say I own a bakery that, among other desserts, sells one really tasty chocolate cake. It's so good that I've estimated that I've estimated 80% of my daily customers will buy a piece of cake, ...
stharms's user avatar
1 vote
1 answer
28 views

Simulating non-zero mean autoregressive (AR(2)) samples

I asked this question in stackoverflow, with no success. I am hoping that i might get some suggestions here. I am trying to generate non-zero mean AR(2) samples using statsmodels package. But it seems ...
Shew's user avatar
  • 297
0 votes
0 answers
22 views

Metropolis-Hastings on domain $(2, \infty)$

I'm trying to understand the Metropolis Hastings algorithm in depth by solving some exercise problems. On one of them, I'm asked to use MH to generate samples from $$f(x) = c \frac{1}{\theta}e^{-\frac{...
Christina Kataki's user avatar
1 vote
1 answer
47 views

Input-Output Correlations using PCA

I want to understand the correlation between a set of $\color{red}{\textrm{inputs}}$ and a set of $\color{blue}{\textrm{outputs}}$ deriving from numerical simulations, and possibly reduce dimensions ...
lukewarn's user avatar
2 votes
1 answer
259 views

Two-component Cox proportional hazards model Simulation

In an article that I have been reading, they have a simulation study: In this simulation, we generate $T_i$ from the following group-specific linear transformation model: $$H(T_i) = \beta_{k,1} X_{i,...
ADAM's user avatar
  • 721
2 votes
0 answers
55 views

Power sizing when sampling from a group with known subgroups

I need to do a power analysis of a group that is composed of three subgroups. The measurements to sample are difference measurements between two dogs of the same breed rated side by side. Dogs are ...
Estimate the estimators's user avatar
1 vote
0 answers
108 views

Tightness of rejection sampling

Hello. I'm studying the Monte Carlo Statistical Method textbook by Robert and Casella. I have a question about exercise problem 30 in Chapter 2. I've already solved parts (a)-(c), but I'm having ...
Kim Gwang Woo's user avatar
2 votes
1 answer
80 views

Is it possible to use simulated (bootstrap) A/A tests of historic data to estimate the impact of confounding factors on the treatment effect?

I recently heard a proposal for a method to measure the degree to which confounding variables impact historic results of A/B tests. In order to ascertain the degree to which confounding has impacted ...
McGez's user avatar
  • 91
2 votes
0 answers
23 views

What are the steps to simulate data showing bias when missing data are MAR

I have been trying to simulate data that shows bias in the estimated regression coefficients when there is data Missing At Random. In this case I am not interested in the estimated coefficients ...
Lynchian's user avatar
  • 157
3 votes
0 answers
14 views

What are the expected residual standard deviations from each of the fitted models and data-generating process?

I simulate data to be analyzed using a linear mixed-effects model. It is based on an experiment with 2 levels (A and B) of a ...
Anderson's user avatar
2 votes
0 answers
50 views

How to Simulate Random Times from Gambler's Ruin?

I saw this question https://stats.stackexchange.com/a/518651/403725 where the distribution of "gambler ruin times" is derived (Discrete Phase Type Distribution): $$\mathbb{P}(T=t) = w_0 \...
Uk rain troll's user avatar
10 votes
1 answer
506 views

The probability that a Brownian bridge is a Brownian excursion

bb <- function() { y <<- c(0,sort(runif(9999)),1) x <<- seq(0,10000)/10000 y <<- y-x } plot(x,y,type="l",asp=30) abline(h=0) The R ...
Michael Hardy's user avatar
4 votes
1 answer
318 views

Simulate data with specified signal to noise ratio for a given sigma

Imagine I have a series $y$ that has a signal and a noise component $y=S+N$. How can I generate $y$ from $S$ and $N$ so that $y$ is 80% signal, 20% noise, and has a given standard deviation? ...
user111024's user avatar
2 votes
2 answers
47 views

Adjusting sd for an ARMA(1,1) simulation given phi and theta

I'd like to generate model an ARMA(1,1) process with a mean of zero and a standard deviation of sigma where I specify the ARMA parameters phi and theta. How can I adjust the value of sigma in the draw ...
user111024's user avatar
7 votes
1 answer
461 views

Understanding importance sampling in Monte Carlo integration

Introduction I'm studying importance sampling and I'm trying to figure out by myself, with a couple of examples, what are the main benefits with respect to standard Monte Carlo integration. I'm not ...
matteogost's user avatar
3 votes
0 answers
83 views

Simulating a (simple) robust mixed-effects model to calculate DHARMa residuals

I am planning to simulate a mixed-effects model fitted with robustlmm::rlmer to validate if the model is correctly specified or not by using ...
medium-dimensional's user avatar
3 votes
1 answer
128 views

Gaussian noise added in social sciences data

In a simulation study (number of simulation $n=200$), there is this quadratic/parabolic function simulated with Gaussian noise added: ...
varin sacha's user avatar
0 votes
0 answers
34 views

Generate time-to-event data from a piecewise exponential model with a binary covariate? [duplicate]

How could I generate time-to-event data from a piecewise exponential model with a binary covariate in R? Could someone point me to some R packages and/or walk through how to code this from scratch?
Learner's user avatar
1 vote
3 answers
83 views

Should You Simulate the Effect of Confounders on Other Confounders to Test an Estimator?

Imagine that I am trying to simulate a data generating process where I make the following assumption about $Y$: $Y$ = $X$(0.15) + $Z_1$(0.23) + $Z_2$(0.08) + $Z_3$(0.19) + $Z_4$(0.05) + Error Also, ...
Brian Lookabaugh's user avatar
0 votes
0 answers
41 views

Inference of a mixture of logistic regression from simulation data in R

Here is the setup and the code that allows to simulate the mixture of 15 component of logistic regression; here each component has 5 common variables that it shares with the other component (with ...
TheBridge's user avatar
  • 207
0 votes
0 answers
68 views

How to compute Expected Squared Jump Distance (ESJD) of a Metropolis-Hastings algorithm

The Expected Squared Jump Distance (ESJD) seems to be defined slightly differently in various papers, which makes this very confusing. For instance, Definition 2.2 of Optimal Scaling of Random-Walk ...
Euler_Salter's user avatar
  • 2,186
2 votes
1 answer
41 views

Simulating Estimates with Potential Heterogenous Treatment Effects

To verify whether a given model can accurately estimate the target estimand of interest, one might generate data to simulate the assumed data generating process, define a treatment effect, and ...
Brian Lookabaugh's user avatar
0 votes
1 answer
24 views

Statistical or Machine Learning Approach for Simulating Variable (proportion)

I am currently facing a challenge in analyzing customer satisfaction data from an electric drive production facility. During a specific period of the month, we encountered technical issues with our ...
R_Student's user avatar
  • 101
1 vote
0 answers
20 views

Can a covariate also be a random effect in glmmTMB model with ar1 [closed]

I have data consisting of catches of insects at weekly intervals over 2 years, repeated with the same methods at the same location 3 decades later. My main question is, have numbers (total and for ...
IMH's user avatar
  • 11
1 vote
0 answers
30 views

Expected deviation between a theoretical discrete probability distribution and the simulated one resulting from a number of trials

Suppose we have seven colors, each associated with a theoretical probability to choose one of them. The probabilities are as follows: red ______ 0.304761904761905 blue _____ 0.304761904761905 yellow ...
TimosL's user avatar
  • 11
4 votes
1 answer
184 views

How to sample using Gibbs with a uniform latent variable?

I trying to sample using Gibbs from a proportional distribucion $f_{Z}(z)$: \begin{align*} f_{Z}(z) \propto e^{-z}\left(1-e^{-z}\right)^4, \quad z >0 \end{align*} using the joint $f_{Z,\textbf{U}...
daniel's user avatar
  • 143
3 votes
1 answer
171 views

Calculating minimum sample size required for repeated measures linear mixed model using the simr package

I would like to use the simr package to calculate the smallest sample size needed to achieve $0.80$ power at the $0.05$ alpha level while accounting for a small ...
AHS's user avatar
  • 31
1 vote
0 answers
56 views

Sampling from a distribution characterized by its characteristic function

Consider the following measure: $$d\nu (x)=\mathbb 1_{(0,1)} (x) \frac 1 {x^{2}}$$ Now, define $X$ with characteristic function given by: $$\varphi_{X}(t)= \exp\left\{ \int_{\mathbb R} [e^{itx}-1 - ...
PSE's user avatar
  • 256
0 votes
0 answers
7 views

Simulating a dataset from model output when model includes multiple binary deviation-coded variables

I am trying to simulate data using parameters from a glmer() model output. The model, which comes from a published paper, is as follows: DV ~ 1 + group* sex *verb type + trial number + (1 |participant)...
user400814's user avatar
2 votes
0 answers
45 views

backcasting AR(1) proccess: How to simulate AR(1) proccess knowing the final value?

I want to simulate an AR(1) process, knowing the last observation, but not the first. This should be an easy problem, but it does not seem to be so. Specifically, I can generate sensible average ...
RB12345's user avatar
  • 21
3 votes
0 answers
116 views

GAMs falsely suggest non-linear function (edf>2) for about 15-25% of simulated data?

I've been learning about GAMs and was curious about how sensitive they are to noise within a given sample. I know people generally say that GAMs are more prone to overfitting than GLMs and need to be ...
Victor Pokorny's user avatar
0 votes
0 answers
54 views

Is a correction needed in the weighting matrix when using the simulated method of moments?

I am following several guides on the simulated method of moments (SMM) and one practical way of getting the weighting matrix, W, is to bootstrap the empirical moments and invert their covariance ...
user400346's user avatar
1 vote
0 answers
71 views

Matching Simulated Moments Perfectly in Practice

Several sources suggest that when estimating a model using the simulated method of moments (SMM), one ought to always be able to get the difference between the empirical and simulated moments to be 0 ...
user400346's user avatar
1 vote
1 answer
65 views

simr Power analysis consistently yields low power

I've been running the following code: ...
elena g's user avatar
  • 11
1 vote
1 answer
42 views

Omitted variable bias: 3 correlated variables and 1 omitted (R simulation)

I get weird results when trying to analyze omitted variable bias in R. If I try to analyze the bias for coefficient $\beta_j$ of variable $x_j$ in case of one omitted variable from set of two ...
Athaeneus's user avatar
  • 123
0 votes
0 answers
26 views

Efficiently sample from a limit set given a differential equation?

Given a dynamical system of many variables, described by an ordinary differential equation, is there some way to use machine learning to efficiently sample from the limit set (or maybe more accurately ...
HelloGoodbye's user avatar
1 vote
2 answers
50 views

Estimating error variance for simulated path analysis

I want to run a simulation using lavaan and simsem to determine the sample size to use in a study using path analysis. The ...
kathryn's user avatar
  • 13
0 votes
0 answers
33 views

Do you know if this re-scaled Dirichlet kernel is known in the literature? How to sample from it?

In a Bayesian analysis, I came across the following distribution that results ends up looking like a re-scaled Dirichlet distribution. The motivation comes from looking at probabilities $x_1, \ldots, ...
Santiago's user avatar

1
2 3 4 5
39