A tweet from JAMA earlier this week:
This issue JAMA publishes a Retraction and Replacement notice for an RCT of transitional care for #COPD. Following discovery of an error in the original analysis, the reanalysis now shows the study’s observed effect changing from strong benefit to harm
This is a striking reminder of the consequences of errors in analysis.
Following best practices, like version control and peer review of analysis code, can help catch errors before publication.
But code will never be 100% bug free. Best practices also help identify the source and consequence of bugs – if you end up having to issue a correction or retract a paper, you’ll be able to reproduce the bad analysis along with a corrected one to conclusively show the cause and effect of the issue.