Re: [R] rbinom

2011-12-30 Thread Scott Raynaud
p@r-project.org" Sent: Tuesday, December 27, 2011 9:15 AM Subject: Re: [R] rbinom On Dec 27, 2011, at 15:47 , Scott Raynaud wrote: > I have the following code (which I did not write) that generates > data based on a logistic model.  I'm only getting a single record > with y=1. 

Re: [R] rbinom

2011-12-27 Thread peter dalgaard
On Dec 27, 2011, at 15:47 , Scott Raynaud wrote: > I have the following code (which I did not write) that generates > data based on a logistic model. I'm only getting a single record > with y=1. It seems implausible that in 50k cases that have a > single y=1. Does that ring alarm bells for

[R] rbinom

2011-12-27 Thread Scott Raynaud
I have the following code (which I did not write) that generates data based on a logistic model.  I'm only getting a single record with y=1.  It seems implausible that in 50k cases that have a single y=1.  Does that ring alarm bells for anyone else?   beta<-c(-1.585600,-0.246900) betasize<-lengt

Re: [R] rbinom and probability

2011-02-04 Thread David Winsemius
On Feb 4, 2011, at 4:24 PM, Mcmahon, Kwyatt wrote: Hello compadRes, I'm developing a script that selects "cells" over a certain metabolic rate to kill them. A rate between 9 and 12 means that the cells are candidates for death. I'll show you what I mean: # a would be a vector of cell m

[R] rbinom and probability

2011-02-04 Thread Mcmahon, Kwyatt
Hello compadRes, I'm developing a script that selects "cells" over a certain metabolic rate to kill them. A rate between 9 and 12 means that the cells are candidates for death. I'll show you what I mean: # a would be a vector of cell metabolic rates. a<-c(8, 7, 9, 6, 10, 11, 4, 5, 6) #now id

Re: [R] rbinom for a matrix

2008-07-10 Thread Ben Bolker
ACroske yahoo.com> writes: > > > Ben: > Thanks for the reply. One further question, and this is where my novice > status at R shows through. The code makes sense, but what would I put it for > "m"? Is it the same number for all three (that was my first thought since it > was the same placeholde

Re: [R] rbinom for a matrix

2008-07-09 Thread ACroske
Yes I do want a random assignment, instead of rounding. (From what I understand of the rbinom command, it will randomly assign 1 or 0, and the higher the given probability, the higher the likelihood of a 1... Feel free to correct me if I'm wrong!) Ben Bolker wrote: > > -BEGIN PGP SIGNED ME

Re: [R] rbinom for a matrix

2008-07-09 Thread ACroske
Ben: Thanks for the reply. One further question, and this is where my novice status at R shows through. The code makes sense, but what would I put it for "m"? Is it the same number for all three (that was my first thought since it was the same placeholder for all three). Number of rows in the matr

Re: [R] rbinom for a matrix

2008-07-09 Thread Dylan Beaudette
On Wednesday 09 July 2008, Ben Bolker wrote: > Dylan Beaudette wrote: > | On Wednesday 09 July 2008, Ben Bolker wrote: > |> ACroske yahoo.com> writes: > |>> I have a large matrix full of probabilities; I would like to convert > > each > > |>> probability to a 1 or a 0 using rbinom. > |>> How can I

Re: [R] rbinom for a matrix

2008-07-09 Thread Ben Bolker
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dylan Beaudette wrote: | On Wednesday 09 July 2008, Ben Bolker wrote: |> ACroske yahoo.com> writes: |>> I have a large matrix full of probabilities; I would like to convert each |>> probability to a 1 or a 0 using rbinom. |>> How can I do this on the

Re: [R] rbinom for a matrix

2008-07-09 Thread Dylan Beaudette
On Wednesday 09 July 2008, Ben Bolker wrote: > ACroske yahoo.com> writes: > > I have a large matrix full of probabilities; I would like to convert each > > probability to a 1 or a 0 using rbinom. > > How can I do this on the entire matrix? The matrix was converted from a > > raster ArcMap dataset,

Re: [R] rbinom for a matrix

2008-07-09 Thread Erik Iverson
Is this what you're looking for? test <- matrix(runif(100, 0, 1), nrow = 20) nr <- nrow(test) matrix(sapply(test, rbinom, n = 1, size = 1), nrow = nr) ACroske wrote: I have a large matrix full of probabilities; I would like to convert each probability to a 1 or a 0 using rbinom. How can I do th

Re: [R] rbinom for a matrix

2008-07-09 Thread Ben Bolker
ACroske yahoo.com> writes: > > > I have a large matrix full of probabilities; I would like to convert each > probability to a 1 or a 0 using rbinom. > How can I do this on the entire matrix? The matrix was converted from a > raster ArcMap dataset, so the matrix is essentially a map. Because of

[R] rbinom for a matrix

2008-07-09 Thread ACroske
I have a large matrix full of probabilities; I would like to convert each probability to a 1 or a 0 using rbinom. How can I do this on the entire matrix? The matrix was converted from a raster ArcMap dataset, so the matrix is essentially a map. Because of this, I have no column headings. Thanks!

[R] "rbinom" not using probability of success right

2008-05-29 Thread Kyle Matoba
Message: 24 Date: Wed, 28 May 2008 05:53:26 -0700 (PDT) From: Philip Twumasi-Ankrah <[EMAIL PROTECTED]> Subject: [R] "rbinom" not using probability of success right To: r-help@r-project.org Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain I am trying to simulat

Re: [R] "rbinom" : Does randomness preclude precision?

2008-05-28 Thread Daniel Nordlund
> -Original Message- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf > Of Philip Twumasi-Ankrah > Sent: Wednesday, May 28, 2008 6:52 AM > To: [EMAIL PROTECTED] > Cc: r-help@r-project.org > Subject: Re: [R] "rbinom" : Does randomness preclude

Re: [R] "rbinom" : Does randomness preclude precision?

2008-05-28 Thread Charles Annis, P.E.
To: [EMAIL PROTECTED] Subject: RE: [R] "rbinom" : Does randomness preclude precision? Charles, When you simulate data from a distribution, what you effect are doing is generating a sequence of values that would correspond to that distribution. So you can generate 1000 values from a norma

Re: [R] "rbinom" : Does randomness preclude precision?

2008-05-28 Thread Charles Annis, P.E.
: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Philip Twumasi-Ankrah Sent: Wednesday, May 28, 2008 9:52 AM To: [EMAIL PROTECTED] Cc: r-help@r-project.org Subject: Re: [R] "rbinom" : Does randomness preclude p

Re: [R] "rbinom" : Does randomness preclude precision?

2008-05-28 Thread Philip Twumasi-Ankrah
Teds reply is a bit comforting and as indicated in my post, I am resorting to using "sample" but as an academic issue, does randomness preclude precision? Randomness should be in the sequence of zeros and ones and how they are simulated at each iteration of the process but not in the eventual n

Re: [R] "rbinom" not using probability of success right

2008-05-28 Thread Ted Harding
On 28-May-08 12:53:26, Philip Twumasi-Ankrah wrote: > I am trying to simulate a series of ones and zeros (1 or 0) and I am > using "rbinom" but realizing that the number of successes expected is > not accurate. Any advice out there. > > This is the example: > > N<-500 > status<-rbinom(N, 1, prob

Re: [R] "rbinom" not using probability of success right

2008-05-28 Thread Prof Brian Ripley
You asked for each of 500 to be included with probability 0.15, not for 15% of 500. If you want the latter, use sample, e.g. sample(c(rep(1,75), rep(0,425))) And to see if your 77 is reasonable for binomial sampling: binom.test(77, 500, 0.15) Exact binomial test data: 77 and 500

Re: [R] "rbinom" not using probability of success right

2008-05-28 Thread Charles Annis, P.E.
] On Behalf Of Philip Twumasi-Ankrah Sent: Wednesday, May 28, 2008 8:53 AM To: r-help@r-project.org Subject: [R] "rbinom" not using probability of success right I am trying to simulate a series of ones and zeros (1 or 0) and I am using "rbinom" but realizing that the number of s

[R] "rbinom" not using probability of success right

2008-05-28 Thread Philip Twumasi-Ankrah
I am trying to simulate a series of ones and zeros (1 or 0) and I am using "rbinom" but realizing that the number of successes expected is not accurate. Any advice out there. This is the example: N<-500 status<-rbinom(N, 1, prob = 0.15) count<-sum(status) 15 percent of 500 should be 75 but wha

Re: [R] rbinom with computed probability

2007-11-24 Thread Berwin A Turlach
G'day Sigalit, On Fri, 23 Nov 2007 11:25:30 +0200 "sigalit mangut-leiba" <[EMAIL PROTECTED]> wrote: > Hello, > I have a loop with probability computed from a logistic model like > this: for (i in 1:300){ > > p[i]<-exp(-0.834+0.002*x[i]+0.023*z[i])/(1+exp(-0.834+0.002*x[i]+0.023 > +z[i])) > > x

Re: [R] rbinom with computed probability

2007-11-23 Thread Ingmar Visser
I don't run into problems doing this: x=rnorm(300) z=rnorm(300) for (i in 1:300){ p[i]<-exp(-0.834+0.002*x[i]+0.023*z[i])/(1+exp(-0.834+0.002*x[i]+0.023 +z[i])); T[i]<-rbinom(1,1,p[i]) } hth, Ingmar On 23 Nov 2007, at 10:25, sigalit mangut-leiba wrote: > Hello, > I have a loop with probabilit

[R] rbinom with computed probability

2007-11-23 Thread sigalit mangut-leiba
Hello, I have a loop with probability computed from a logistic model like this: for (i in 1:300){ p[i]<-exp(-0.834+0.002*x[i]+0.023*z[i])/(1+exp(-0.834+0.002*x[i]+0.023 +z[i])) x and z generated from normal distribution. I get 300 different probabilities And I want to generate variables from bern