similar to: Why R simulation gives same random results?

Displaying 20 results from an estimated 30000 matches similar to: "Why R simulation gives same random results?"

2009 Apr 23
3
Floating simulation error
Hi all, I am running a simulation and a curious error keeps coming up that stops the whole process. The error is a subscript out of bounds error, and it seems to happen at different points (floating around) throughout the looping simulation. Say, for example, it crashes on sample 1 - iteration 200. I can force it to start again on iteration 202 with all of the same settings, and it is
2005 Aug 04
1
Counterintuitive Simulation Results
I wonder if someone can help me understand some counterintuitive simulation results. Below please find 12 lines of R code that theoretically, to the best of my understanding, should produce essentially a flat line with no discernable pattern. Instead, I see an initial dramatic drop followed by a slow rise to an asymptote. The simulation computes the mean of 20,000 simulated trajectories
2012 Aug 14
2
What package to use to calculate odds ratio and the confidence interval?
Hi list, I am trying to calculate the sensitivity, specificity, and odds ratio(and confidence interval). Say, my data looks like this 42.53, 37.56, 40.51, 32.67, 38.19, 81.74, 41.55, 68.94, 59, 63, 54.13, 48.85, 50.46, 51.78 Is there any packages in R that does this? Espeically the odds ratio confidence interval. Mike [[alternative HTML version deleted]]
2006 Aug 16
1
[SPAM] - RE: REML with random slopes and random intercepts giving strange results - Bayesian Filter detected spam
Can you provide the summary(m2) results? > -----Original Message----- > From: Simon Pickett [mailto:S.Pickett at exeter.ac.uk] > Sent: Wednesday, August 16, 2006 7:14 AM > To: Doran, Harold > Cc: r-help at stat.math.ethz.ch > Subject: [SPAM] - RE: [R] REML with random slopes and random > intercepts giving strange results - Bayesian Filter detected spam > > Hi again,
2000 Jan 19
1
random number generator
This question may not be specific to R, but I'm using R so here goes: Since R is slow (as is Splus) I want to split a simulation and run it on 2 or 3 systems at once. The simulations involve generating a large number of random values. How can I set .Random.seed so that the succession of random values don't overlap across systems. I see that when I invoke R and give command runif(1) a
2005 Mar 04
11
R: simulation
hi all a simple question i want to run simulations in r. i however want the experiments to be repeated at a later time with exactly the same numbers by other users. can i set the random number seed for rnorm in some way? e.g. is there some arguement that goes with rnorm? please supply an example regards Allan
2012 Dec 05
3
data manipulation between vector and matrix
Dear list, I was curious how to subtract a vector from matrix? Say, I have mat <- matrix(1:40, nrow=20, ncol=2) x <-c(1,2) I want, x-mat[1,] and x-mat[2,], and so on... Basically, subtract column elements of x against column elements in mat. But x-mat won't do it. Thanks, Mike [[alternative HTML version deleted]]
2004 Mar 24
2
geoR - help for bayesian modelling
Hi, I am trying to do a bayesian prediction for soil pollution data above a certain threshold, using geoR. Everything is working fine until i am doing the krig.bayes. I tried to do the prediction on a grid 67 by 113 cells and my computer is freezing to death. At larger numbers of cells it tells me after a while that it reaches the max. memory of 511 Mb. My computer has only 512 Mb of RAM.
2004 Dec 17
1
reading the seed from a simulation
Greetings, I have a simulation of a nonlinear model that is failing. But it does not fail til way into the simulation. I would like to look at the run that is failing and maybe I could if I could capture the seed for the failing run. The help file on set.seed says you can do it but when I tried rs<-.Random.seed print(paste("rs",rs,sep=" ")) I got 626 of them so I
2011 Oct 17
1
Best practices for handling very small numbers?
Greetings I have been experimenting with sampling from posterior distributions using R. Assume that I have the following observations from a normal distribution, with an unscaled joint likelihood function: normsamples = rnorm(1000,8,3) joint_likelihood = function(observations, mean, sigma){ return((sigma ^ (-1 * length(observations))) * exp(-0.5 * sum( ((observations - mean ) ^ 2)) / (sigma
2009 Aug 14
1
Simulation Function - Save results
Hi listers, I am working on a simulation... But I am having some troubles... Suppose I have a function A which produces two results (mean and variance)... Then I would like to simulate this function A with a function B many times using the results from function A For example: #Function A boot<-function(a,b,c){ mean_boot<-(a+b)/2 var_boot<-c #list(a=a,b=b,c=c) return(a) } Then I would
2009 Jul 23
1
error message: .Random.seed is not an integer vector but
Thanks much Ted. I actually had just tried what you suggest here before you posted, and resolved the problem. Thanks also for the other tips. I wrote x = as.vector(c(1:12)) because I thought that the mode of x might be the problem, the error message pointing to .Random.seed notwithstanding. On a related note, I did a brief test a couple weeks back where I ran a million random samples of 3 from
2013 Mar 18
1
How to stop set.seed() besides exiting out of R?
Hi list, I am curious how to stop the set.seed(), I don't want the same repeated random number. I know I can set it to a different seed, but I don't want to go through the trouble of setting different seed every time. Thanks, Mike [[alternative HTML version deleted]]
2004 Feb 22
3
Simulation help
I am a new R user. As a test, I want to write a simple code that does the following simulation: 1. Randomly generate a number from a distribution, say, Poisson. Let's say that number is 3. 2. Randomly generate 3 numbers from another distribution, say, Normal. 3. Compute the sum of the numbers generated in step 2 and read it into a vector, V. 4. Repeat steps 1 through 3 for 100,000 times. 5.
2008 Dec 04
2
R simulations
I need help with these R simulations _______________________________________ The generation of pseudo-random numbers with uniform distribution [0.1] can be done through a method called Congruencial Committee, which consists the use of a recursive relationship of the type: xi +1 = (a.xi + c) mod m being a, c, and the positive integers m, c <m. Discuss in light of possible values of a, c, my
2005 Aug 13
2
monte carlo simulations/lmer
Hi - I am doing some monte carlo simulations comparing bayesian (using Plummer's jags) and maximum likelihood (using lmer from package lme4 by Bates et al). I would like to know if there is a way I can flag nonconvergence and exceptions. Currently the simulations just stop and the output reads things like: Error in optim(.Call("lmer_coef", x, 2, PACKAGE = "Matrix"), fn,
2011 Jul 27
3
Is R the right choice for simulating first passage times of random walks?
Dear R folks, I need to simulate first passage times for iterated partial sums. The related papers are for example [1][2]. As a start I want to simulate how long a simple random walk stays negative, which should result that it behaves like n^(-?). My code looks like this. -------- 8< -------- code -------- >8 -------- n = 100000 # number of simulations length = 100000 # length of
2006 Jul 26
2
residual df in lmer and simulation results
Hello. Douglas Bates has explained in a previous posting to R why he does not output residual degrees of freedom, F values and probabilities in the mixed model (lmer) function: because the usual degrees of freedom (obs - fixed df -1) are not exact and are really only upper bounds. I am interpreting what he said but I am not a professional statistician, so I might be getting this wrong... Does
2006 Jun 29
1
using "rbinom" in C code gives me erroneous results... random variable is not random (always zero)...
Dear Listers, I am trying to use "rbinom" in my C code, but i always get zeros as output no matter the probability. Am not sure what I am doing wrong because the function has worked before. Attached in an example. Noticed that "rbinom" expects 'n' to be REAL. Regards, Vumani R 2.3.1 (2006-06-01) Windows XP Gcc /* Called this file binom.c and then ran rcmd shlib on it
2006 Jun 18
1
Bayesian Networks with deal
Ein eingebundener Text mit undefiniertem Zeichensatz wurde abgetrennt. Name: nicht verf?gbar URL: https://stat.ethz.ch/pipermail/r-help/attachments/20060618/a60e3fff/attachment.pl