R/getformula.R

#' Extract the formula from a model
#' 
#' Extract the model formula from a fitted object.
#' 
#' The \code{getformula} function will extract the formula from a fitted model.
#' 
#' @param x A fitted model.
#'
#' @docType methods
#' @aliases getformula-methods
#' @export
setGeneric("getformula", function(x) standardGeneric("getformula"),
           package = "btergm")

#' @describeIn getformula Extract the formula from an \code{ergm} object.
#' @export
setMethod("getformula", signature = className("ergm", "ergm"), 
          definition = function(x) x$formula)

#' @describeIn getformula Extract the formula from a \code{btergm} object.
#' @export
setMethod("getformula", signature = className("btergm", "btergm"), 
          definition = function(x) x@formula)

#' @describeIn getformula Extract the formula from an \code{mtergm} object.
#' @export
setMethod("getformula", signature = className("mtergm", "btergm"), 
          definition = function(x) x@formula)

#' @describeIn getformula Extract the formula from a \code{tbergm} object.
#' @export
setMethod("getformula", signature = className("tbergm", "btergm"), 
          definition = function(x) x@formula)

Try the btergm package in your browser

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

btergm documentation built on Oct. 6, 2023, 1:07 a.m.