The posterior predictive distribution is the distribution of the outcome implied by the model after using the observed data to update our beliefs about the unknown parameters in the model. Simulating data from the posterior predictive distribution using the observed predictors is useful for checking the fit of the model. Drawing from the posterior predictive distribution at interesting values of the predictors also lets us visualize how a manipulation of a predictor affects (a function of) the outcome(s). With new observations of predictor variables we can use the posterior predictive distribution to generate predicted outcomes.
# S3 method for pandemicEstimated
posterior_predict(object, horizonLong = 500, horizonShort = 14, ...)An object of class pandemicEstimated created by function pandemic_model.
How far into the future the long-term prediction is desired.
How far into the future the short-term prediction is desired.
Currently unused.
An object of class pandemicPredicted. It includes the sampled predictive distribution
the model used to predict, which is the same as the one used to estimate the data. This object can be used
directly into the plot function and contains the following elements:
predictive_LongA M x horizonLong matrix with the full sample of the predictive distribution
for the long-term prediction, where M is the sample size.
The prediction is for daily new cases.
predictive_ShortA M x horizonShort matrix with the full sample of the predictive distribution
for the short-term prediction, where M is the sample size.
The prediction is for daily cumulative cases.
dataThe data passed on from the pandemicEstimated-objects under the element Y$data.
locationA string with the name of the location.
cases_typeA string with either "confirmed" or "deaths" to represent the type of data that has been fitted and predicted.
pastMuThe fitted means of the data for the observed data points.
futMuThe predicted means of the data for the predicted data points.
CovidLP Team, 2020. CovidLP: Short and Long-term Prediction for COVID-19. Departamento de Estatistica. UFMG, Brazil. URL: http://est.ufmg.br/covidlp/home/en/
pandemic_model, pandemic_stats and plot.pandemicPredicted. Details
about the models behind the calculations can be seen in models.
# NOT RUN {
dataMG = load_covid("Brazil","MG")
estimMG = pandemic_model(dataMG)
predMG = posterior_predict(estimMG)
predMG
# }
Run the code above in your browser using DataLab