#' Make Hill Equation predictions for plotting
#'
#' @param drm_model
#'
#' @return a tibble of theoretetical pCa values and their estimated y-values using the parameters generated by the fit of the drm model
#' @export
#'
#' @examples predict_hill(my_drm_model)
predict_hill <- function(drm_model){
# Makes a list of a lot of random pCa values.
theoretical_pCa_values <- expand.grid(pCa=exp(seq(log(4), log(10), length=100)))
# This will make y-predictions based off the theoretical "x" values provided in the "theorectical_pCa_values" list and will include confidence intervals
predicted_model_values <- predict(drm_model, newdata = theoretical_pCa_values, interval="confidence", level = 0.95)
predicted_model_values <- as.tibble(predicted_model_values)
# Take the predicted values tibble provided from "predicted_model_values" and add the theoretical_pCa values as a column
final_prediction_tibble <- predicted_model_values %>%
mutate(theoretical_pCa = theoretical_pCa_values$pCa)
final_prediction_tibble %>% dplyr::rename(predicted_y = Prediction, lower_error = Lower, upper_error = Upper)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.