R/diagnostics.R

Defines functions diagnostics.gwrf_fit diagnostics

Documented in diagnostics

#' Extract diagnostics from a gwrf_fit object
#'
#' @param object A gwrf_fit object.
#' @param ... Unused.
#'
#' @return A named list containing overall model diagnostics:
#' \describe{
#'   \item{rmse}{Root mean squared error across fitted focal observations.}
#'   \item{mae}{Mean absolute error across fitted focal observations.}
#'   \item{r2}{Coefficient of determination calculated from observed and
#'   predicted focal values.}
#'   \item{n_focal}{Number of focal observations for which local models were
#'   requested.}
#' }
#'
#' @examples
#' example_fit <- structure(
#'   list(
#'     diagnostics = list(
#'       rmse = 0.25,
#'       mae = 0.18,
#'       r2 = 0.80,
#'       n_focal = 3
#'     )
#'   ),
#'   class = "gwrf_fit"
#' )
#'
#' diagnostics(example_fit)
#' @export
diagnostics <- function(object, ...) {
  UseMethod("diagnostics")
}

#' @export
diagnostics.gwrf_fit <- function(object, ...) {
  object$diagnostics
}

Try the gwrf package in your browser

Any scripts or data that you put into this service are public.

gwrf documentation built on Aug. 24, 2026, 5:15 p.m.