When you provide an actual minimal reproducible example we will be able to help you. 2000 lines is excessive to demonstrate the problem.
Based on your description, I think you are doing some computations before you set seed, and your results depend partly on the values computed prior to the set.seed. On August 19, 2021 1:10:28 AM PDT, Shah Alam <dr.alamsola...@gmail.com> wrote: >Dear Petr, > >It is more than 2000 lines of code with a lot of functions and data inputs. >I am not sure whether it would be useful to upload it. However, you are >absolutely right. I used > >Step 1. Self-coded functions (these functions generate random numbers as >well) > >Step 2: set.seed (123) > >Step 3: Call those functions. > >Step 4: model results. > >I close the R session and run the code from step 1. I get different results >for the same set of values for parameters. > >Best regards, >Shah > > > > >On Thu, 19 Aug 2021 at 09:56, PIKAL Petr <petr.pi...@precheza.cz> wrote: > >> Hi >> >> Please provide at least your code preferably with some data to reproduce >> this behaviour. I wonder if anybody could help you without such >> information. >> >> My wild guess is that you used >> >> set.seed(1234) >> >> some code >> >> the code used again >> >> in which case you have to expect different results. >> >> Cheers >> Petr >> >> > -----Original Message----- >> > From: R-help <r-help-boun...@r-project.org> On Behalf Of Shah Alam >> > Sent: Thursday, August 19, 2021 9:46 AM >> > To: r-help mailing list <r-help@r-project.org> >> > Subject: [R] Getting different results with set.seed() >> > >> > Dear All, >> > >> > I was using set.seed to reproduce the same results for the discrete event >> > simulation model. I have 12 unknown parameters for optimization (just a >> > little background). I got a good fit of parameter combinations. However, >> > when I use those parameters combinations again in the model. I am getting >> > different results. >> > >> > Is there any problem with the set.seed. I assume the set.seed should >> > produce the same results. >> > >> > I used set.seed(1234). >> > >> > Best regards, >> > Shah >> > >> > [[alternative HTML version deleted]] >> > >> > ______________________________________________ >> > R-help@r-project.org 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. >> > > [[alternative HTML version deleted]] > >______________________________________________ >R-help@r-project.org 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. -- Sent from my phone. Please excuse my brevity. ______________________________________________ R-help@r-project.org 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.