R/isFunctions.R

Defines functions is.scale is.rmc is.rollingOrigin is.greyboxD is.greyboxC is.occurrence is.alm is.greybox

Documented in is.alm is.greybox is.greyboxC is.greyboxD is.occurrence is.rmc is.rollingOrigin is.scale

#' Greybox classes checkers
#'
#' Functions to check if an object is of the specified class
#'
#' The list of functions includes:
#' \itemize{
#' \item \code{is.greybox()} tests if the object was produced by a greybox function
#' (e.g. \link[greybox]{alm} / \link[greybox]{stepwise} / \link[greybox]{lmCombine}
#' / \link[greybox]{lmDynamic});
#' \item \code{is.alm()} tests if the object was produced by \code{alm()} function;
#' \item \code{is.occurrence()} tests if an occurrence part of the model was produced;
#' \item \code{is.greyboxC()} tests if the object was produced by \code{lmCombine()}
#' function;
#' \item \code{is.greyboxD()} tests if the object was produced by \code{lmDynamic()}
#' function;
#' \item \code{is.rmc()} tests if the object was produced by \code{rmc()} function;
#' \item \code{is.rollingOrigin()} tests if the object was produced by \code{ro()}
#' function;
#' \item \code{is.scale()} tests if the object is of the class "scale" (produced by
#' \link[greybox]{alm} or \link[greybox]{sm} in case of heteroscedastic model);
#' }
#'
#' @param x The object to check.
#' @return  \code{TRUE} if this is the specified class and \code{FALSE} otherwise.
#'
#' @template author
#' @keywords ts univar
#' @examples
#'
#' xreg <- cbind(rlaplace(100,10,3),rnorm(100,50,5))
#' xreg <- cbind(100+0.5*xreg[,1]-0.75*xreg[,2]+rlaplace(100,0,3),xreg,rnorm(100,300,10))
#' colnames(xreg) <- c("y","x1","x2","Noise")
#'
#' ourModel <- alm(y~x1+x2, xreg, distribution="dnorm")
#'
#' is.alm(ourModel)
#' is.greybox(ourModel)
#' is.greyboxC(ourModel)
#' is.greyboxD(ourModel)
#'
#' @rdname isFunctions
#' @export
is.greybox <- function(x){
    return(inherits(x,"greybox"))
}

#' @rdname isFunctions
#' @export
is.alm <- function(x){
    return(inherits(x,"alm"))
}

#' @rdname isFunctions
#' @export
is.occurrence <- function(x){
    return(inherits(x,"occurrence"))
}

#' @rdname isFunctions
#' @export
is.greyboxC <- function(x){
    return(inherits(x,"greyboxC"))
}

#' @rdname isFunctions
#' @export
is.greyboxD <- function(x){
    return(inherits(x,"greyboxD"))
}

#' @rdname isFunctions
#' @export
is.rollingOrigin <- function(x){
    return(inherits(x,"rollingOrigin"))
}

#' @rdname isFunctions
#' @export
is.rmc <- function(x){
    return(inherits(x,"rmc"))
}

#' @rdname isFunctions
#' @export
is.scale <- function(x){
    return(inherits(x,"scale"))
}

Try the greybox package in your browser

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

greybox documentation built on Sept. 16, 2023, 9:07 a.m.