[R] Simulation help

2006-09-20 Thread Zodet, Marc W. (AHRQ)
I'm trying to simulate trend data over a five year period. I want different trend profiles...the simplest being a linear trend. I've been using the following code: patBdta1 - NULL for(i in 1:100) patBdta1 - rbind(patBdta1,c(yr1= mean(rbinom(50,1,.50)), yr2

Re: [R] Simulation help

2006-09-20 Thread ONKELINX, Thierry
-Oorspronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Zodet, Marc W. (AHRQ) Verzonden: woensdag 20 september 2006 15:29 Aan: r-help@stat.math.ethz.ch Onderwerp: [R] Simulation help I'm trying to simulate trend data over a five year period. I want different trend

Re: [R] Simulation help

2004-02-25 Thread Peter Dalgaard
Spencer Graves [EMAIL PROTECTED] writes: How about the following: set.seed(5) N - 8 # later 10 (nPois - rpois(N, 2)) [1] 1 3 4 1 0 3 2 3 z - rnorm(sum(nPois)) ? I read the original request as simulating the sum of a Poisson distributed number of Normals. So I'd suggest

[R] Simulation Help

2004-02-23 Thread Jonathan Wang
In a reply to my inquiry, a respondent offered the following simulation code: lens - rpois(10, 3) V - numeric(10) for(i in 1:length(lens)) V[i] - sum(rnorm(lens[i])) quantile(V, c(.95, .99)) The code worked exactly the way I wanted. I had an Excel model that does the same thing.

[R] Simulation help

2004-02-22 Thread jonathan_wang
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

RE: [R] Simulation help

2004-02-22 Thread Richard Pugh
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: 22 February 2004 17:18 To: [EMAIL PROTECTED] Subject: [R] 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

Re: [R] Simulation help

2004-02-22 Thread Spencer Graves
How about the following: set.seed(5) N - 8 # later 10 (nPois - rpois(N, 2)) [1] 1 3 4 1 0 3 2 3 z - rnorm(sum(nPois)) V - tapply(z, rep(1:N, nPois), sum) quantile(V, c(0, .05, .25, .5, .75, .95, 1)) 0% 5%25%50%75%95% 100%

Re: [R] Simulation help

2004-02-22 Thread Spencer Graves
Of [EMAIL PROTECTED] Sent: 22 February 2004 17:18 To: [EMAIL PROTECTED] Subject: [R] 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

RE: [R] Simulation help

2004-02-22 Thread Richard Pugh
- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: 22 February 2004 17:18 To: [EMAIL PROTECTED] Subject: [R] 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