In null-hypothesis significance testing, if we were to optionally stop data collection every so often and check the p value on the data, the null hypothesis may be eventually be rejected even when it is true.
I would like to simulate some data to help myself understand this problem more deeply, but I'm having trouble getting some R code together to demonstrate it. I was hoping someone could provide some guidance on how to generate a dataset in R to demonstrate the optional stopping problem. That is, to show that even when sampling from a population where the null is true we may eventually attain p < .05.