[R] uniform number

Boris Steipe boris.steipe at utoronto.ca
Mon May 5 13:46:48 CEST 2014


... or this could mean to accept or reject an edge with p = 0.01 or 0.1 in which case you *might* use rbinom() as in

n <- 100   # number of edges
p <- 0.27  # desired probability
rbinom(n,1,p)
  [1] 0 1 0 0 0 1 0 0 0 0 0 0 0 1 1 0 0 1  ... etc.

B.

On 2014-05-05, at 5:19 AM, Rolf Turner wrote:

> 
> 
> Please keep responses on-list unless there are compelling reasons not to.
> 
> It is still not clear what you want to do.  You *might* want to assign
> probabilities to the edges of a graph where these probabilities are uniformly (and independently) distributed on the interval [0.01, 0.10].
> 
> This could be done by
> 
> probs <- runif(n,0.01,0.10)
> 
> where "n" is the number of edges.  See ?runif.
> 
> You *might* want to assign probabilities either 0.01 or 0.10 to each edge of the graph, each probability being chosen with probability 0.5 (???).  This could be done by
> 
> probs <- sample(c(0.01,0.10),n,TRUE).
> 
> You really need to learn something about R if you are going to use R.
> Start with "An Introduction to R" available (under "Manuals") from the R web site.
> 
> You also need to learn to express yourself clearly and unambiguously. Do not expect your readers to be telepathic.
> 
> cheers,
> 
> Rolf Turner
> 
> On 05/05/14 19:41, Ragia Ibrahim wrote:
>> 
>> thanks for replying
>> in the following paper
>> http://www.cs.cornell.edu/home/kleinber/kdd03-inf.pdf
>> page 6 third paragraph
>> 
>> 
>> the author writes:
>> "assigned a uniform probability of p to each edge of the graph, choosing
>> p to be 1% and 10%
>> in separate trials."
>> 
>> 
>> how to use R function to get such probability ?
>> Regards
>> 
>> 
>> > Date: Mon, 5 May 2014 19:27:43 +1200
>> > From: r.turner at auckland.ac.nz
>> > To: ragia11 at hotmail.com
>> > CC: r-help at r-project.org
>> > Subject: Re: [R] uniform number
>> >
>> > On 05/05/14 17:05, Ragia Ibrahim wrote:
>> > >
>> > > Dear group,
>> > > How to generate uniform probability choosing p to be 2% and 5%, in
>> separate trials for 100 times.
>> >
>> > No idea WTF you are talking about. Can you formulate a question that is
>> > comprehensible to the human mind?
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list