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.1111 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 the probability for each one should be 0.1 and not 0.11111 (which is, consistently with the definition, 1/9) It looks like one of the extremes is not considered in the computation of the probability, but then it's assigned a probability anyway. Similar problem with punif. if I do punif(1, min=1, max=10) I get 0 as result, as if the lower extreme is not considered, which is not consistent with the description where min <= x <= max If the lower extreme is not considered because cdf(x) = p(X<x) {and not p(X<=x)} the problem stands in p(X<11) which should be the sum of everything. ( P(1) + P(2) + ... + P(10) ) What is happening here? ______________________________________________ R-help@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.