Compare All MEMC Models
ModelComparison.Rmd
Compare all of the default results from the MEMC model configurations included within the package. This example will show users how to run MEMC model configurations and how to visualize the results.
Start by loading the package.
# This assumes that the package has already been installed, see installation instructions.
library(MEMC)
# See https://ggplot2-book.org/ for more details on data visualization.
library(ggplot2)
theme_set(theme_bw())
Take look at the table of package model configurations.
model_configs
#> model DOMuptake POMdecomp MBdecay
#> 1 MEND MM MM LM
#> 2 COMISSION MM RMM LM
#> 3 CORPSE RMM LM LM
#> 4 MEMS LM LM LM
#> 5 BAMS MM MM LM
#> 6 MIMCS MM MM DD
Run all 6 model configurations using the solve_model
function
# Vector for the time steps
times <- seq(0, 600, by = 1)
# Solve all the model configurations.
out1 <- solve_model(mod = MEND_model, time = times)
out2 <- solve_model(mod = COMISSION_model, time = times)
out3 <- solve_model(mod = CORPSE_model, time = times)
out4 <- solve_model(mod = MEMS_model, time = times)
out5 <- solve_model(mod = BAMS_model, time = times)
out6 <- solve_model(mod = MIMCS_model, time = times)
# Save all of the output in a single data frame for plotting.
out <- rbind(out1, out2, out3, out4, out5, out6)
Visualize results!
ggplot(data = out) +
geom_line(aes(x = time, y = value, color = name), linewidth = 1, alpha = 0.85) +
facet_wrap("variable", scales = "free") +
labs(x = "Time", y = "mg C/g", title = "MEMC Model Comparison") +
scale_color_manual(values = MEMC::colorMEMCPalette())