Learn R Programming

reghelper (version 0.3.3)

fitted.block_glm: Extract model fitted values.

Description

fitted method for class "block_glm".

Usage

# S3 method for block_glm
fitted(object, num = NULL, ...)

Arguments

object

An object of class "block_glm", usually, a result of a call to build_model.

num

Numeric vector with the index of model(s) from which to return the fitted values.

...

Further arguments passed to or from other methods.

Value

The fitted values of block(s) `num`, or if `num` is NULL, a list of fitted values from all blocks.

See Also

build_model, coef.block_glm, residuals.block_glm

Examples

Run this code
# NOT RUN {
# 2 blocks: Petal.Length; Petal.Length + Petal.Width
model1 <- build_model(Sepal.Length, Petal.Length, Petal.Width, data=iris, model='lm')
summary(model1)
fitted(model1)  # returns both blocks 1 and 2

# 2 blocks: Species; Species + Petal.Length + Petal.Width + Petal.Length:Petal.Width
model2 <- build_model(Sepal.Length, Species, c(Petal.Length * Petal.Width), data=iris, model='lm')
summary(model2)
fitted(model2, num=2)  # returns second block
# }

Run the code above in your browser using DataLab