Many funding agencies require grantees to deposit their data into an archive after they finish their research projects. The archive processes and disseminates the data for public use. These deposited data sets are public goods that benefit users and society. However, under voluntary contribution, public goods tend to be under-provided. For normal public goods, the contributors benefit from their own contributions as much as free-riders. Contributors are not harmed by their contributions. In the data sharing case, data producers make efforts to prepare the data for deposit, but the benefit of the data preparation largely goes to secondary users. In addition, data producers are at risk of being harmed by the misuse and misinterpretation of data by unqualified users, or by being charged with misconduct. That makes free-riding even more attractive. To motivate data producers to prepare and share data, there must be some incentive mechanisms. In this paper, I built a simple mathematic model to analyze the effects of punishment and reward. Hopefully it will help policy makers decide on incentive mechanisms for data sharing.