fitted-methods | R Documentation |
Extracts fitted values from a fitted regression model.
Generic function
Extractor function for fitted values.
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.
Diethelm Wuertz for the Rmetrics R-port.
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.