Re: [R] Dunif and Punif

2011-11-07 Thread Peter Langfelder
On Mon, Nov 7, 2011 at 8:49 AM, michele donato wrote: > Hi, > I am trying to use dunif and runif > however, I have two problems: > if I do > > dunif(1:10, min=1, max=10) > > I get 10 values, which summed give me 1. > I understand that the probability is computed as f(x) = 1 / (max-min) > but i

Re: [R] Dunif and Punif

2011-11-07 Thread R. Michael Weylandt
A point of clarification: dDIST() sometimes gives a pmf, e.g., dpois(). But dunif() is a pdf. Sorry for the typo. Michael On Mon, Nov 7, 2011 at 12:08 PM, R. Michael Weylandt wrote: > In short, the unif() distribution corresponds to the continuous > uniform distribution, not the discrete. > >

Re: [R] Dunif and Punif

2011-11-07 Thread R. Michael Weylandt
In short, the unif() distribution corresponds to the continuous uniform distribution, not the discrete. Longer: dDIST() doesn't give a pmf so summing it isn't what you are looking for: it gives a pdf. For punif() consider P\{X <= 1\} when X is distributed on [1, 10]. Clearly this has probability z

[R] Dunif and Punif

2011-11-07 Thread michele donato
Hi, I am trying to use dunif and runif however, I have two problems: if I do dunif(1:10, min=1, max=10) I get 10 values, which summed give me 1. I understand that the probability is computed as f(x) = 1 / (max-min) but in this case it looks wrong: I have 10 values, each one equiprobable, and