StatModel-class {modeltools}R Documentation

Class "StatModel"

Description

A class for unfitted statistical models.

Objects from the Class

Objects can be created by calls of the form new("StatModel", ...).

Slots

name:
Object of class "character", the name of the model.
dpp:
Object of class "function", a function for data preprocessing (usually formula-based).
fit:
Object of class "function", a function for fitting the model to data.
predict:
Object of class "function", a function for computing predictions.
capabilities:
Object of class "StatModelCapabilities".

Methods

fit
signature(model = "StatModel", data = "ModelEnv"): fit model to data.

Details

This is an attempt to provide unified infra-structure for unfitted statistical models. Basically, an unfitted model provides a function for data pre-processing (dpp, think of generating design matrices), a function for fitting the specified model to data (fit), and a function for computing predictions (predict).

Examples


  ### linear model example
  df <- data.frame(x = runif(10), y = rnorm(10))
  mf <- dpp(linearModel, y ~ x, data = df)
  mylm <- fit(linearModel, mf)

  ### the same
  print(mylm)
  lm(y ~ x, data = df)

  ### predictions
  Predict(mylm, newdata =  data.frame(x = runif(10)))


[Package modeltools version 0.2-0 Index]