Skip to main content

Section 5.15 πŸ’‘ Reproducibility Tip:

When your analysis involves randomness-such as simulated data, resampling, or random assignmentβ€”always set a seed using set.seed().
Because we used set.seed(123) when generating the data in this chapter, anyone who runs the code will obtain identical results. This ensures that differences in output are due to changes in code or assumptions, not randomness.
Setting a seed is a simple but essential step for reproducible research, especially when teaching, sharing code, or revisiting an analysis later.
It does not matter what the seed is set to, as long as it is set to something!