I'm simulating some panel data for a regression and every time I run the simulation, I obtain different data. I tried changing the position of the set.seed()
function (at the top of the program, inside the for loop...) but I couldn't manage to replicate the results.
The program consists of two nested for loops, one for each individual and the other one for each time period of the data. Within the loops, there are a series of Markov chains for which I use runif()
, sample()
and rbinom()
.
Also, I'm using R markdown and this particular chunk of code comes after some other simulations. Surprisingly, I was able to replicate my results for the other ones. I'm happy to provide more details or the code itself.
Aucun commentaire:
Enregistrer un commentaire