methods-fitted: Extract Regression Model Fitted Values

fitted-methodsR Documentation

Extract Regression Model Fitted Values

Description

Extracts fitted values from a fitted regression model.

Methods

object = "ANY"

Generic function

object = "fREG"

Extractor function for fitted values.

Note

fitted is a generic function which extracts fitted values from objects returned by modeling functions, here the regFit and gregFit parameter estimation functions.

The class of the fitted values is the same as the class of the data input to the function regFit or gregFit. In contrast the slot fitted returns a numeric vector.

Author(s)

Diethelm Wuertz for the Rmetrics R-port.

Examples

## regSim -
   x.df = regSim(model = "LM3", n = 50)
  
## regFit -
   # Use data.frame input:
   fit = regFit(Y ~ X1 + X2 + X3, data = x.df, use = "lm")
   
## fitted - 
   val = slot(fit, "fitted")
   head(val)
   class(val)
   val = fitted(fit)
   head(val)
   class(val)
   
## regFit -
   # Convert to dummy timeSeries Object:
   library(timeSeries)
   x.tS = as.timeSeries(x.df)
   fit = regFit(Y ~ X1 + X2 + X3, data = x.tS, use = "lm")
   
## fitted - 
   val = slot(fit, "fitted")
   head(val)
   class(val)
   val = fitted(fit)
   head(val)
   class(val)

fRegression documentation built on Jan. 14, 2024, 8:23 p.m.