seed problem?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

seed problem?

Mika Hamari
Hi!

I have Windows 10 on PC and different versions of R. I noticed that when I executed simulation with R 4.0.3, it gave exactly the same results next time when I re-opened the program. I didn�t set the seed.

I tested this also with simple �rnorm(10,100,10)�, and the results were every time the same, when I re-opened the program. It seems that it starts with the same seed. R 4.0.0 and 4.0.3 did it, both with 32- and 64-bit versions. But with R Studio the results were every time different, as they were also different with 3.4.3. This explains, why I hadn�t noticed this earlier.

I know the function set.seed(), but I wonder, how in the first place seed can be every time same, if you don�t set it to be. What I read about seeds, this should be very highly improbable occurence.

Thanks to all developers for what they are doing for common good. I love R!

Mika Hamari

        [[alternative HTML version deleted]]


______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: seed problem?

Jeff Newmiller
Check if you have a .RData file in your R startup directory. It may contain the seed.

.RData files (without anything in front of the period) are dangerous... many R users avoid them because they can easily drag in mistakes from previous sessions to plague you.

On March 28, 2021 9:02:17 AM PDT, Mika Hamari <[hidden email]> wrote:

>Hi!
>
>I have Windows 10 on PC and different versions of R. I noticed that
>when I executed simulation with R 4.0.3, it gave exactly the same
>results next time when I re-opened the program. I didn�t set the seed.
>
>I tested this also with simple �rnorm(10,100,10)�, and the results were
>every time the same, when I re-opened the program. It seems that it
>starts with the same seed. R 4.0.0 and 4.0.3 did it, both with 32- and
>64-bit versions. But with R Studio the results were every time
>different, as they were also different with 3.4.3. This explains, why I
>hadn�t noticed this earlier.
>
>I know the function set.seed(), but I wonder, how in the first place
>seed can be every time same, if you don�t set it to be. What I read
>about seeds, this should be very highly improbable occurence.
>
>Thanks to all developers for what they are doing for common good. I
>love R!
>
>Mika Hamari
>
> [[alternative HTML version deleted]]

--
Sent from my phone. Please excuse my brevity.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: seed problem?

Mika Hamari
Thank you, Jeff! I had that file, and when I removed it, that solved the problem. Now random numbers are really random. Excellent!

Mika


Lähetetty Samsung Galaxy -älypuhelimesta.


-------- Alkuperäinen viesti --------
Lähettäjä: Jeff Newmiller <[hidden email]>
Päivämäärä: 29.3.2021 10.31 (GMT+02:00)
Saaja: [hidden email], Mika Hamari <[hidden email]>, [hidden email]
Aihe: Re: [R] seed problem?

Check if you have a .RData file in your R startup directory. It may contain the seed.

.RData files (without anything in front of the period) are dangerous... many R users avoid them because they can easily drag in mistakes from previous sessions to plague you.

On March 28, 2021 9:02:17 AM PDT, Mika Hamari <[hidden email]> wrote:

>Hi!
>
>I have Windows 10 on PC and different versions of R. I noticed that
>when I executed simulation with R 4.0.3, it gave exactly the same
>results next time when I re-opened the program. I didn�t set the seed.
>
>I tested this also with simple �rnorm(10,100,10)�, and the results were
>every time the same, when I re-opened the program. It seems that it
>starts with the same seed. R 4.0.0 and 4.0.3 did it, both with 32- and
>64-bit versions. But with R Studio the results were every time
>different, as they were also different with 3.4.3. This explains, why I
>hadn�t noticed this earlier.
>
>I know the function set.seed(), but I wonder, how in the first place
>seed can be every time same, if you don�t set it to be. What I read
>about seeds, this should be very highly improbable occurence.
>
>Thanks to all developers for what they are doing for common good. I
>love R!
>
>Mika Hamari
>
>       [[alternative HTML version deleted]]

--
Sent from my phone. Please excuse my brevity.

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: seed problem?

Bill Dunlap-2
In reply to this post by Mika Hamari
Does this happen if you start R with the --vanilla flag?  If so it may
be that you have a startup file, .\.Rprofile or %HOME%\.Rprofile that
is calling set.seed(n) for a fixed n.

-Bill

On Mon, Mar 29, 2021 at 12:16 AM Mika Hamari <[hidden email]> wrote:

>
> Hi!
>
> I have Windows 10 on PC and different versions of R. I noticed that when I executed simulation with R 4.0.3, it gave exactly the same results next time when I re-opened the program. I didn’t set the seed.
>
> I tested this also with simple ”rnorm(10,100,10)”, and the results were every time the same, when I re-opened the program. It seems that it starts with the same seed. R 4.0.0 and 4.0.3 did it, both with 32- and 64-bit versions. But with R Studio the results were every time different, as they were also different with 3.4.3. This explains, why I hadn’t noticed this earlier.
>
> I know the function set.seed(), but I wonder, how in the first place seed can be every time same, if you don’t set it to be. What I read about seeds, this should be very highly improbable occurence.
>
> Thanks to all developers for what they are doing for common good. I love R!
>
> Mika Hamari
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: seed problem?

Mika Hamari
Thank you Bill for your help! In other cases this surely is good thing to check, but in my case it helped earlier today that I removed .RData file according to Jeff�s answer:

�Check if you have a .RData file in your R startup directory. It may contain the seed.�

Now that this file doesn�t exist, random numbers are random.

Mika

L�hett�j�: Bill Dunlap<mailto:[hidden email]>
L�hetetty: maanantai 29. maaliskuuta 2021 18.56
Vastaanottaja: Mika Hamari<mailto:[hidden email]>
Kopio: [hidden email]<mailto:[hidden email]>
Aihe: Re: [R] seed problem?

Does this happen if you start R with the --vanilla flag?  If so it may
be that you have a startup file, .\.Rprofile or %HOME%\.Rprofile that
is calling set.seed(n) for a fixed n.

-Bill

On Mon, Mar 29, 2021 at 12:16 AM Mika Hamari <[hidden email]> wrote:

>
> Hi!
>
> I have Windows 10 on PC and different versions of R. I noticed that when I executed simulation with R 4.0.3, it gave exactly the same results next time when I re-opened the program. I didn�t set the seed.
>
> I tested this also with simple �rnorm(10,100,10)�, and the results were every time the same, when I re-opened the program. It seems that it starts with the same seed. R 4.0.0 and 4.0.3 did it, both with 32- and 64-bit versions. But with R Studio the results were every time different, as they were also different with 3.4.3. This explains, why I hadn�t noticed this earlier.
>
> I know the function set.seed(), but I wonder, how in the first place seed can be every time same, if you don�t set it to be. What I read about seeds, this should be very highly improbable occurence.
>
> Thanks to all developers for what they are doing for common good. I love R!
>
> Mika Hamari
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-help&amp;data=04%7C01%7C%7C7b2bd48fb686441312fd08d8f2cb2f43%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637526301761924646%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=mmOJg62ljt3x2Adp60HLHJqdg%2FtDS6EaW%2B%2ByfcEsimk%3D&amp;reserved=0
> PLEASE do read the posting guide https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.r-project.org%2Fposting-guide.html&amp;data=04%7C01%7C%7C7b2bd48fb686441312fd08d8f2cb2f43%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637526301761924646%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=mitEm6LuTLS7fPrSlsVGYvn5gyU2hNCXy70gqqp9DJc%3D&amp;reserved=0
> and provide commented, minimal, self-contained, reproducible code.

        [[alternative HTML version deleted]]


______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.