R/KFAS-defunct.R

Defines functions subset.SSModel `subset<-` `subset<-.SSModel` deviance.KFS

Documented in deviance.KFS subset.SSModel

#' Defunct Functions of Package KFAS
#'
#' The function listed here are removed from KFAS.
#'
#' Subset-based methods were removed as they were somewhat confusingly
#' named as the \code{subset} generic in \code{base}, and most likely not
#' that useful (compared to \code{\link{[<-.SSModel}}).
#'
#' Deviance.KFS was removed as it was mostly useless. The value was not a \eqn{-2*(logL-logL*)}
#' where \eqn{L} is the likelihood and \eqn{L*} is the saturated likelihood.
#' Instead it was based on the conditional likelihood \eqn{p(y|theta)} i.e. it disregards
#' the effect of hidden states. Therefore the value
#' returned by this function did not make much sense in non-GLM setting.
#' 
#' From \code{rstandard.KFS} and \code{residuals.KFS}: Computation of deviance residuals. 
#' This option was meant to be used only for the GLM comparisons, as their 
#' generalization to other models is lacking, but in order to avoid misleading 
#' results in non-GLM settings, these are now completely removed.
#' 
#' @export
#' @aliases KFAS-defunct
#' @name KFAS-defunct
#' @rdname KFAS-defunct
#' @keywords internal
deviance.KFS <- function(object, ...) {
  .Defunct()
  sum(residuals(object, type = "deviance") ^ 2, na.rm = TRUE)
}

#' @method subset<- SSModel
#' @export
#' @rdname KFAS-defunct
`subset<-.SSModel` <- function(x, element, states, etas, series, times,
                               ..., value) {
  .Defunct(new = "[<-.SSModel")
  x[element, states, etas, series, times, ...] <- value
  x
}
#' @rdname KFAS-defunct
#' @export
`subset<-` <- function(x, ..., value) {
  .Defunct(new = "[<-")
  UseMethod("subset<-")
}

#' @method subset SSModel
#' @export
#' @rdname KFAS-defunct
subset.SSModel <- function(x, element, states, etas, series, times, ...) {
  .Defunct(new = "[.SSModel")
  x[element, states, etas, series, times, ...]

}

Try the KFAS package in your browser

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

KFAS documentation built on Sept. 8, 2023, 5:56 p.m.