Code for : An evolutionary model to predict the frequency of antibiotic resistance under seasonal antibiotic use, and an application to Streptococcus pneumoniae François Blanquart, Sonja Lehtinen, Christophe Fraser May 2017 Description of the data and code used: likelihood_Fourier.R: main code for data analysis. - For each population (B = Bedouin, J = Jewish), loads the dataset of resistance and consumption (all.B.csv or all.J.csv), approximate the prescription time series as a Fourier series - For each antibiotic prescribed (amoxicillin, cephalosporin, azithromycin), optimise the full likelihood, then the approximate likelihood, then compute confidence intervals using MCMC - save everything in .RData files functions_fourier.R: auxiliary functions loaded in likelihood_Fourier.R - run_MCMC function to compute MCMC confidence intervals - get.fourier function to obtain Fourier series coefficient of the time series of antibiotic prescription - get.cons function to obtain antibiotic prescription at any time from the fourier coefficients - get.integral function to compute the integral (the sum in equation 7 of the paper) - get.pred.multi2 function to obtain predicted frequency of resistance under the full model (equation 7 of the paper) - get.pred.get.pred.multi.approx2 function to obtain predicted frequency of resistance under the approximate model (equation 5 of the paper) - lik.multi2 full likelihood function - lik.multi.approx2 approximate likelihood function all.B.csv: data for Bedouin childen, a csv file with 10 columns, obtained from figures 1 and 2 in Dagan et al. JID 2008 year.cat the year category, from 1999 to 2004 every month (60 lines) res.pen percent strain resistant to penicillin res.ery percent strain resistant to erythromycin res.multi percent strain multiply resistant cons.amo prescription of amoxicillin per 1000 children per month cons.amocla prescription of amoxicillin + clavulanate per 1000 children per month cons.amotot total prescription amoxicillin per 1000 children per month cons.ceph prescription of cephalosporin per 1000 children per month cons.azi prescription of azithromycin per 1000 children per month cons.tot total prescription per 1000 children per month all.J.csv: data for Jewish childen, a csv file with 10 columns, obtained from figures 1 and 2 in Dagan et al. JID 2008 year.cat the year category, from 1999 to 2004 every month (60 lines) res.pen percent strain resistant to penicillin res.ery percent strain resistant to erythromycin res.multi percent strain multiply resistant cons.amo prescription of amoxicillin per 1000 children per month cons.amocla prescription of amoxicillin + clavulanate per 1000 children per month cons.amotot total prescription amoxicillin per 1000 children per month cons.ceph prescription of cephalosporin per 1000 children per month cons.azi prescription of azithromycin per 1000 children per month cons.tot total prescription per 1000 children per month