Message-ID: <4992D8B4.4070206@ufl.edu>
Date: 2009-02-11T13:55:00Z
From: Ben Bolker
Subject: Generating Numbers With Certain Distribution in R
In-Reply-To: <45f568c70902110535h61d97a01ja0f186f7ba489f5a@mail.gmail.com>
Gustaf Rydevik wrote:
> On Wed, Feb 11, 2009 at 2:15 PM, Ben Bolker <bolker at ufl.edu> wrote:
>> Bernardo Rangel Tura wrote:
>>
>>> I think your routine need a little fix
>>>
>>> x <- rlnorm(1e6,meanlog=1,sdlog=1) ## pick any parameters you like
>>> y <- round((x-min(x)/diff(range(x)))*199999+1)
>>>
>>> What you think?
>> Yes.
>
>
> No.
> Bernardo misplaced the parenthesis around (x-min(x))
> Correct version is:
>
> x <- rlnorm(1e6,meanlog=1,sdlog=1) ## pick any parameters you like
> y <- round((x-min(x))/diff(range(x))*199999+1)
>
>
Sorry, I'm obviously not paying enough attention.
I will be interested to hear back from Gundala Viswanath
to see if this solves his (?) problem (I sort of doubt it).
Ben