#' Title
#'
#' @param m
#' @param X_new
#' @param effort_new
#' @param se.fit
#' @param prediction_type
#'
#' @return
#' @export
#'
#' @examples
predict.brve <- function (object,
newdata = NULL,
offset = log(effort),
type = c("abundance", "probability"),
se.fit = TRUE,
...) {
type <- match.arg(type)
# Make predictions to new data
predict_function <- switch(type,
abundance = predict_abundance,
probability = predict_probability)
p <- predict_function(object, newdata, se.fit)
# return the prediction
p
}
#' @noRd
predict_abundance <- function(object, newdata, se.fit) {
if(se.fit == TRUE) {
stop("Cannot fit standard errors in abundance prediction in brve")
}
p <- predict.glm(object,
type = "link",
se.fit = se.fit,
newdata = newdata)
exp(p)
}
#' @noRd
predict_probabiltiy <- function(object, newdata, se.fit) {
predict.glm(object,
type = "response",
se.fit = se.fit,
newdata = newdata)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.