Performs Bayesian inference on an epidemiological model using MCMC sampling. This function generates a Turing.jl model from the EpiProblem specification, runs the specified inference method, and returns posterior samples with diagnostics.

fit(model, data, method = nuts_sampler(), ...)

Arguments

model

An EpiProblem object specifying the complete model.

data

A data frame or list containing observed data. Must have a column/element named y_t or cases with case counts. Optionally can include dates.

method

A sampler configuration object (e.g., from nuts_sampler). Default: nuts_sampler().

...

Additional arguments (currently unused).

Value

An S3 object of class epiaware_fit containing:

samples

posterior::draws_df object with MCMC samples

summary

tibble with parameter summaries

diagnostics

tibble with convergence diagnostics (Rhat, ESS)

generated_quantities

List with generated quantities (Rt, infections, etc.)

model

The original EpiProblem

data

The data used for inference

method

The inference method used

Examples

if (FALSE) { # \dontrun{
# Load data
data <- read.csv("south_korea_data.csv")
training_data <- data[45:80, ]

# Fit model
results <- fit(
  model = mishra_model,
  data = training_data,
  method = nuts_sampler(warmup = 1000, draws = 1000, chains = 4)
)

# Examine results
print(results)
summary(results)
plot(results, type = "Rt")
} # }