Epidemics of infectious disease can be traced back to the early days of mankind. Only in the last two centuries vaccination has become a viable strategy to prevent such epidemics. In addition to the clinical efficacy of this strategy, the behavior and public attitudes affect the success of vaccines. This paper describes modeling the efficacy of vaccination considering the cost and benefit of vaccination to individual players. The model is based on the public goods game and is presented as a spatial game on a lattice. Using this model, individuals can contribute to the public health by paying the cost of vaccination or choose to be protected by the public who is vaccinated rather than pay the cost and share the risk of vaccination. Thus, in this model individuals can choose to stay susceptible, can become infected, or choose to vaccinate once in each episode. This paper presents the behavioral changes of the population and the cost to the society as a function of the cost of vaccines, cost of being infected, and the "fear factor" created by the public media.