[R] Drawing random numbers from Uniform distribution with infinite range
Richard O'Keefe
r@oknz @end|ng |rom gm@||@com
Tue Jul 29 22:53:51 CEST 2025
R can only represent representable numbers.
The cardinality of the set of numbers that could be the result of
sampling in R is
some finite number a bit less than 2^64. It's not even countably infinite.
The real line is UNcountably infinite.
Almost no points on the real line can be represented.
Second, any random selection from any set is going to be
according to *some* probability distribution. The whole without any
preference for any particular probability distribution" makes no sense.
(Can you possibly be thinking of Bayesian 'improper priors'?)
Bearing in mind the finiteness of representable numbers and the
intrinsic necessity of having *some* probability distribution,
why do you think you need to do this thing that cannot be done?
On Tue, 29 Jul 2025 at 04:51, Daniel Lobo <danielobo9976 using gmail.com> wrote:
>
> Many thanks for your guidance. However my original problem is, how to
> select n points in the Real line randomly without any preference of
> any particular probability distribution?
>
> On Mon, 28 Jul 2025 at 21:45, Rui Barradas <ruipbarradas using sapo.pt> wrote:
> >
> > On 7/28/2025 5:00 PM, Daniel Lobo wrote:
> > > Hi,
> > >
> > > I want to draw a set of random number from Uniform distribution where
> > > Support is the entire Real line.
> > >
> > > runif(4, min = -Inf, max = Inf)
> > >
> > > However it produces all NAN
> > >
> > > Could you please help with the right approach?
> > >
> > > ______________________________________________
> > > R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > > https://stat.ethz.ch/mailman/listinfo/r-help
> > > PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
> > > and provide commented, minimal, self-contained, reproducible code.
> > Hello,
> >
> >
> > What you are asking doesn't make sense.
> > The uniform distribution's PDF is
> >
> > f(x;a, b) = 1/abs(b - a) if x in [a, b]
> > 0 otherwise
> >
> > So what you have is 1/abs(Inf - -Inf) = 1/abs(Inf) = 0.
> >
> > And the cumulative distribution function is even worse, it will give you
> > the indeterminate Inf/Inf.
> > See the Wikipedia on the uniform distribution [1].
> >
> >
> > [1] https://en.wikipedia.org/wiki/Continuous_uniform_distribution
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide https://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list