R/AIC.R

#' AIC
#' @param object an object of class econet
#' @param centrality string. It is used when \code{object} is produced by \code{horse_race}.
#' @method AIC econet
#' @importFrom stats AIC
#' @noRd
#' @export
"AIC.econet" <- function(object, centrality = "parameter.dependent", ..., k) {

  if (!is.null(attributes(object)$attr)) {
    x <- object[[1]][[centrality]]
  } else {
    x <- object[[1]]
  }

  res <- AIC(x)

  return(res)
}
#' @rdname AIC
#' @param object an object of class summary.econet
#' @param centrality string. It is used when \code{object} is produced by \code{horse_race}.
#' @method AIC summary.econet
#' @importFrom stats AIC
#' @noRd
#' @export
"AIC.summary.econet" <- function(object, centrality = "parameter.dependent", ..., k) {

  if (!is.null(attributes(object)$attr)) {
    x <- object[[1]][[centrality]]
  } else {
    x <- object[[1]]
  }

  res <- AIC(x)

  return(res)
}

Try the econet package in your browser

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

econet documentation built on April 28, 2022, 1:07 a.m.