## ----message=FALSE, warning=FALSE--------------------------------------------- library(ec50estimator) library(drc) library(ggplot2) ## ----------------------------------------------------------------------------- data(multi_isolate) example_data <- subset( multi_isolate, isolate %in% 1:5 & fungicida == "Fungicide A" ) head(example_data) ## ----------------------------------------------------------------------------- data_check <- check_ec50_data( example_data, response = "growth", dose = "dose", isolate = "isolate", strata = "field" ) data_check ## ----------------------------------------------------------------------------- fit <- ec50_multimodel( growth ~ dose, data = example_data, isolate_col = "isolate", strata_col = "field", fct = list(drc::LL.3(), drc::LL.4(), drc::W2.3()), interval = "delta" ) head(fit) ## ----------------------------------------------------------------------------- fit_quality(fit) fit_failures(fit) ## ----------------------------------------------------------------------------- selection <- model_selection(fit) selection[, c("ID", "field", "model", "IC", "delta", "weight", "rank")] ## ----------------------------------------------------------------------------- best <- best_model(fit) best[, c("ID", "field", "model", "Estimate", "Lower", "Upper", "IC")] ## ----fig.alt="Faceted dose-response plot showing raw observations and the best-supported fitted curve for each isolate and field."---- plot_EC50_curves(fit, models = "best") ## ----fig.alt="Faceted dose-response plot showing raw observations and all candidate fitted curves for each isolate and field."---- plot_EC50_curves(fit) ## ----------------------------------------------------------------------------- report <- report_ec50(fit, models = "best") report ## ----------------------------------------------------------------------------- predict_ec50( fit, dose = c(0.001, 0.01, 0.1), models = "best" ) ## ----------------------------------------------------------------------------- curves <- curve_data(fit) head(curves) ## ----fig.alt="Custom ggplot2 dose-response curve figure built from curve_data output."---- ggplot(curves, aes(dose, growth, color = factor(isolate), linetype = model)) + geom_line(linewidth = 1) + facet_wrap(~field) + scale_x_log10() + labs(x = "Dose", y = "Growth", color = "Isolate") + theme_light() ## ----------------------------------------------------------------------------- head(residual_data(fit, models = "best")) ## ----fig.alt="Residual diagnostic plot for best-supported EC50 models."------- plot_residuals(fit, models = "best")