Model fitting and inference for infectious disease dynamics