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
-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
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
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.
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
-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
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%
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
-
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