# simulation

1. ### [Compounded returns series simulation] PDF of product of normal random variables

Hello, To simulate compounded returns in financial series, I'm trying to find an algorithm to compute the PDF of the product of "n" normally-distributed random variables. Even if, actually, the variables are not normally distributed, in order to simplify it I could assume that they have the...
2. ### I need someone to write me a basic code please!!

Hi, I am learning basic programming with R, and I desperately need someone to write me a PSEUDO code and code for it please: Here's the situation "you have been sentenced to die tomorrow, but you're offered a way out... you get given 12 red balls and 12 blue balls together with two urns...
3. ### Correlation pvalue from a bootstrap

I'm working through some machine learning stuff that deals with simulation/bootstrapping and come across a point where a pvalue is calculated but not how it was calculated. This is precisely the type of work I'm moving towards so I want to understand how to do it. Here's what the author of the...
4. ### Improved Monte-Carlo method vs. hit-and-miss method

I am not understanding *Which is more accurate, the hit-and-miss method or the improved Monte-Carlo method?* http://www-stat.stanford.edu/~susan/courses/s208/node14.html it is written that that the hit-and-miss has a higher variance but they showed (variance of improved Monte-Carlo) -...
5. ### Calibrating time-series simulations / backtests

Suppose I have a time-series data generating process that I am trying to simulate. The simulations are controlled by 2 discrete variables: −3<= A<=3 and 0<= B<= 10. When backtesting, the simulations perform reasonably well, but I'd like the find the optimal values of A and B for calibration. I...
6. ### robustness-analysis of one-factor anova in R with negative-binomial distributed data

Hello everyone, I'd like to examine the robustness of the Anova, given that the dependent variable is not distributed normally, but negative binomial. Therefore, I use the following code: pvalue = rep(NA, 100000) n = c(352, 198, 170) group = rep(1:3, n) for (i in...
7. ### Population genetics: prediction of allele frequency distribution

Is there a software or a R package that does a simulation of spatial distribution of alleles? I'm interested in how a distribution of alleles of functional loci is shaped by a pattern of environmental variables, such as temperatures and water quality. I have data on geographical patterns of...
8. ### Capture sums, not means, from individual iterations in a Monte Carlo simulation

I am having difficulty setting up what should be a fairly straightforward application of the Monte Carlo Simulation function in SPSS 21. I have a dataset that includes hospitalization costs for a specific patient population. I set up a simulation that randomly selects a subset of cases based on...
9. ### Difference between MCMCsamp and sim

Trying to get confidence intervals on a fixed effect in a mixed model fitted with the lmer function in package lme4 in R. I can get distributions of beta using "mcmcsamp" function and estimate a confidence interval from that, but I can also do it using "sim" in the package arm. While they both...
10. ### Simulation of unlikely events over random binary variables knowing their probability

Hi, I have n binary variables all having the same probability p of flipping. Probability is low, so I wouldn't want to go through generating a random number for every one of them in order to flip their value. I know that the expected number of flips for the n variables is m = n*p. I could use...
11. ### Create loop for Monte Carlo Simulation

Hi I have some trouble writing out a monte carlo simulation properly. I assign variables for the process before the steps. The first step is assigning variable j = j + 1 Second step i draw three random numbers from a U(0,1) dist. u1, u2 and u3. Third step is a long if formula. It...
12. ### Mic Check my simulation

I'm not a statistician but like to pretend. I help a friend write simulations in R but don't really do the math end. Here's a small baby attempt at a simulation to answer Noetsi's question of how using a single Likert item vs an interval scale affects the estimates and slopes. Please give...
13. ### Comparison of the power of the tests: Parametric test versus Non-parametric test

How can one compare using a simple experimentation or simulation whether a parametric test (e.g. t-test) is more powerful than its non-parametric counterpart (Wilcoxon signed rank test)? I understand that statistical power is defined as the probability of rejecting the null hypothesis when it...
14. ### simulation for probability

I'm a brand new R user, and I have what is probably a very easy question. I ran a simulation to figure out a probability question. I'll show the code below, but I was wondering if anybody could tell me a more efficient way to do what I've done. The basic question is "If the correlation...
15. ### Multivariate analysis with dependent variables and replicates

Dear All, I have been stuck in this issue for 2nd day now. I have a dataset of 13 depended variables (consequitive (not repeated!) measurment ("profiles" from one batch of product) and there are 3 batches (replicates) and within each batch there are 10 containers. So I am dealing with...
16. ### Estimating parameters of simulated Normal Data sets

Dear Sir/Madam, I am doing a simulation study. For my study, I need to simulate 10,000 data sets from standard normal distribution(each with 100 observations) and need to estimate the mean and standard deviation parameters of all 10,000 data sets. I used replicate function to generate...
17. ### Generate random variate: What does this symbol mean?

Hi. I'm reading a book about how to simulate random variate (from some distribution). But, when i look at the algorithm there, is has a leftarrow symbol, which i'm not sure what does it mean. I try googling but most of the results only state the LaTeX code for such symbol without further...
18. ### Simulation with Dichotomous Random Variables in R

Hi, I am a bit new to R (I've used Stata before), but I am trying to figure out how to do a simulation in which I want dichotomous random variables whose expectation has a form like that of the distribution function of a logistic random variable. So far, I've decided to use runif, and I...
19. ### [WINGEN] - Data generation with IRT

Hello everybody, I have a simulation study and I try to generate irt data with a program called WINGEN. I want to generate dichotomously scored, normal distributed and unidimensional data. And I my number of examinees are 10000, number of items 40 and my irt model is 2PLM. WINGEN asks me...
20. ### Data generation study with irt

Hello everybody, I have a simulation study and I try to generate irt data with a program called WINGEN. I want to generate dichotomously scored, normal distributed and unidimensional data. And I my number of examinees are 10000, number of items 40 and my irt model is 2PLM. WINGEN asks me...