model.interface-class: (Internal) An interface for model.adapter and...

model.interface-classR Documentation

(Internal) An interface for model.adapter and statistical/machine learning models.

Description

This class provides unified interface for calls/objects of statistical/machine learning models. model.adapter-class{model.adapter} internally using object of this class to get information from model calls/objects.

Methods

get.family(x, type = c("character", "family"), envir)

Get family from the model.

x

call or model object.

type = c("character", "family")

a character literal specifying the type of data returned. If "character", this returns character vector of family name. If "family", this returns family object. For some family specific for certain model (e.g., categorical family of MCMCglmm), their family object is not implimented. For such family, this method raise stop error.

envir

environment where x is evaluated.

get.call(x)

This method returns call by which the object is made. If call is not available, this returns NULL. To distinguish the returned value of NULL is intended action or not, inherited classes are encouraged to inherit this method to explicitly return NULL if x does not have call.

x

call or model object.

get.data(x, envir, package = "", ...)

Get a data.frame containing the data used for modeling. If data is not available this method returns NULL.

x

a model object/call from which data is extracted.

envir

an environment in which call is evaluated.

get.formula(x, envir, package = "")

Extract formula from model object/call. If couldn't retrieve formula from x, this method returns NULL.

x

a model object/call from which formula is extracted.

envir

an environment in which call in x is evaluated.

package

name of the package having the modeling function.

expand.formula(f, d, specials = NULL, package = NULL)

Expand . in formula.

f

a formula to expand.

d

a data.frame used to expand . in formula.

specials = NULL

special characterss passed to terms.formula.

package = NULL

a character literal of package name having the model function.

predict(object, newdata, type, random, ...)

Calculate predictions.

object

a model object used for prediction.

newdata

a data.frame containing data used for prediction.

type

the type of prediciton. This should be a type specific for each modeling functions.

random = ~0

the random effect to use. Tentatively, ~0 means don't use random effects.

...

other variables passed to predict methods.

get.link(x, envir)

Get link function. If the model does not have link function, this function returns identity function.

x

an object of statistical model or a call of model function.

envir

an environment where call in x is evaluated.

get.linkinv(x, envir)

Get inverse function of link function. If the model does not have link function, this function returns identity function.

x

an object of statistical model or a call of model function.

envir

an environment where call in x is evaluated.

get.model.type(x, envir, package = "", ...)

Return a character vector specifying model type (regression or classification). If the model is regression model, it returns 'regression'. If the model is classification model, it returns 'classification'.

x

an object of statistical model or a call of model function.

envir

an environment where call in x is evaluated.

has.offset.argument(x, envir, package = "")

Check whether the model has offset argument.

x

an object of statistical model or a call of model function.

envir

an environment where call in x is evaluated.

package = NULL

a character literal of package name having the model function.

has.offset.in.formula(x, envir, package = "")

Check whether the model has offset term(s) in formula.

x

an object of statistical model or a call of model function.

envir

an environment where formula and data in x is evaluated.

package = NULL

a character literal of package name having the model function.

Active bindings

predict.types

a named character vector representing the conversion table of shared type of prediction used for predict() method. Currently, this vector has four elements named "response", "link", "prob" and "class" and each element represents compatible type of character for the model.

Methods

Public methods


Method new()

Usage
model.interface.default.class$new(...)

Method get.family()

Usage
model.interface.default.class$get.family(
  x,
  type = c("character", "family"),
  envir
)

Method get.call()

Usage
model.interface.default.class$get.call(x)

Method get.data()

Usage
model.interface.default.class$get.data(x, envir, package = "", ...)

Method get.formula()

Usage
model.interface.default.class$get.formula(x, envir, package = "")

Method expand.formula()

Usage
model.interface.default.class$expand.formula(
  f,
  d,
  specials = NULL,
  package = NULL
)

Method predict()

Usage
model.interface.default.class$predict(object, newdata, type, random, ...)

Method get.link()

Usage
model.interface.default.class$get.link(x, envir)

Method get.linkinv()

Usage
model.interface.default.class$get.linkinv(x, envir)

Method get.model.type()

Usage
model.interface.default.class$get.model.type(x, envir, package = "", ...)

Method get.offset.names()

Usage
model.interface.default.class$get.offset.names(x, envir, package = "")

Method adjust.offset()

Usage
model.interface.default.class$adjust.offset(
  x,
  envir,
  package,
  pred,
  newdata,
  type,
  divide.by.mean = TRUE
)

Method clone()

The objects of this class are cloneable with this method.

Usage
model.interface.default.class$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


Marchen/model.adapter documentation built on July 3, 2023, 11:07 a.m.