[R] Ignoring the domain of RV in punif()

Hamed Ha h@medh@@eli @ending from gm@il@com
Tue Oct 23 11:04:53 CEST 2018

Hi All,

I recently discovered an interesting issue with the punif() function.  Let
X~Uiform[a,b] then the CDF is defined by F(x)=(x-a)/(b-a) for (a<= x<= b).
The important fact here is the domain of the random variable X. Having said
that, R returns CDF for any value in the real domain.

I understand that one can justify this by extending the domain of X and
assigning zero probabilities to the values outside the domain. However,
theoretically, it is not true to return a value for the CDF outside the
domain. Then I propose a patch to R function punif() to return an error in
this situations.

> punif(10^10)
[1] 1


	[[alternative HTML version deleted]]

More information about the R-help mailing list