# Set up odeModel list for the Fitzhugh-Nagumo equations
fnmodel <- list(
fOde = fnmodelODE,
fOdeDx = fnmodelDx,
fOdeDtheta = fnmodelDtheta,
thetaLowerBound = c(0, 0, 0),
thetaUpperBound = c(Inf, Inf, Inf)
)
# Example FN data
data(FNdat)
y <- setDiscretization(FNdat, by = 0.25)
# Create magioutput from a short MagiSolver run (demo only, more iterations needed for convergence)
result <- MagiSolver(y, fnmodel, control = list(nstepsHmc = 20, niterHmc = 500))
# Inferred trajectories
plot(result, comp.names = c("V", "R"), xlab = "Time", ylab = "Level")
# Parameter trace plots
plot(result, type = "trace", par.names = c("a", "b", "c", "sigmaV", "sigmaR"), sigma = TRUE)
Run the code above in your browser using DataLab