[R] Needed: Understading runif() output :-)

Kjetil Kjernsmo kjetil.kjernsmo at astro.uio.no
Thu May 25 19:48:38 CEST 2000


On Thu, 25 May 2000, Prof Brian D Ripley wrote:

>Yes, they are all quantized (all to ca 2^-31 or 2^-32).  Reason: that's
>all we can assume for integer arithmetic. 

Yes, indeed.

>That is perfectly
>sufficient for a *stable* procedure for using them. As I said before, I
>don't think the algorithm you have for making use of them is adequate.  
>Now, you haven't actually told us how you are generating numbers from your
>distribution (and you haven't actually defined the distribution precisely
>enough so that I could program it), but I guess you are using inversion.  
>Don't: it is not adequate for your purposes.

Aha, now I understand! 
Indeed, I use inversion. My (cumulative) distribution function is 
F(mu) = 1 - 0.25 * mu^-2, for mu >= 0.5 and 0 for mu < 0.
I have inverted it, to get the 1 / (2 * sqrt(1 - p) quantile function,
then I use runif(n) for the p.

>  You want to make use of
>several random numbers if you want behaviour in the far tail.
>Alternatively, you could plug in a generator that had a lower quantization.
>
>The moral is a familiar one: computer results are almost always
>approximate, and you always have to watch out for the effects of the
>approximations.

Yes, it is a valuable lesson to learn. It is not that often the effects of
the approximation are that glaring. I'm thinking about if I can live with
this approximation in this case.

I guess I should have a more thorough look into it nevertheless. My lack
of training in statistics strikes again, I have based my analysis on a
brief discussion in Dudewicz & Mishra's "Modern Mathematical
Statistics". If someone can recommend a text that discuss this topic, I
would be very happy...
 
Best,

Kjetil
-- 
Kjetil Kjernsmo
Graduate astronomy-student                    Problems worthy of attack
University of Oslo, Norway            Prove their worth by hitting back
E-mail: kjetikj at astro.uio.no                                - Piet Hein
Homepage <URL:http://www.astro.uio.no/~kjetikj/>
Webmaster at skepsis.no 


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list