The fitted values are extracted from each lm component of object and arranged into a list with as many components as object, or combined into a single vector.

# S3 method for class 'lmList'
fitted(object, subset, asList, ...)

Arguments

object

an object inheriting from class "lmList", representing a list of lm objects with a common model.

subset

an optional character or integer vector naming the lm components of object from which the fitted values are to be extracted. Default is NULL, in which case all components are used.

asList

an optional logical value. If TRUE, the returned object is a list with the fitted values split by groups; else the returned value is a vector. Defaults to FALSE.

...

some methods for this generic require additional arguments. None are used in this method.

Value

a list with components given by the fitted values of each lm component of object, or a vector with the fitted values for all lm components of object.

Author

José Pinheiro and Douglas Bates bates@stat.wisc.edu

Examples

fm1 <- lmList(distance ~ age | Subject, Orthodont)
fitted(fm1)
#>   M01   M01   M01   M01   M02   M02   M02   M02   M03   M03   M03   M03   M04 
#> 24.90 26.80 28.70 30.60 21.05 22.60 24.15 25.70 22.00 23.50 25.00 26.50 26.10 
#>   M04   M04   M04   M05   M05   M05   M05   M06   M06   M06   M06   M07   M07 
#> 26.45 26.80 27.15 20.45 22.15 23.85 25.55 24.35 25.70 27.05 28.40 21.35 22.95 
#>   M07   M07   M08   M08   M08   M08   M09   M09   M09   M09   M10   M10   M10 
#> 24.55 26.15 22.75 23.50 24.25 25.00 22.20 24.15 26.10 28.05 27.25 28.75 30.25 
#>   M10   M11   M11   M11   M11   M12   M12   M12   M12   M13   M13   M13   M13 
#> 31.75 22.65 23.30 23.95 24.60 21.25 23.25 25.25 27.25 18.40 22.30 26.20 30.10 
#>   M14   M14   M14   M14   M15   M15   M15   M15   M16   M16   M16   M16   F01 
#> 23.30 24.35 25.40 26.45 22.50 24.75 27.00 29.25 21.35 22.45 23.55 24.65 20.25 
#>   F01   F01   F01   F02   F02   F02   F02   F03   F03   F03   F03   F04   F04 
#> 21.00 21.75 22.50 20.60 22.20 23.80 25.40 21.20 22.90 24.60 26.30 23.45 24.40 
#>   F04   F04   F05   F05   F05   F05   F06   F06   F06   F06   F07   F07   F07 
#> 25.35 26.30 21.80 22.35 22.90 23.45 20.00 20.75 21.50 22.25 21.35 22.45 23.55 
#>   F07   F08   F08   F08   F08   F09   F09   F09   F09   F10   F10   F10   F10 
#> 24.65 22.85 23.20 23.55 23.90 20.30 20.85 21.40 21.95 17.15 18.05 18.95 19.85 
#>   F11   F11   F11   F11 
#> 24.35 25.70 27.05 28.40 
#> attr(,"label")
#> [1] "Fitted values (mm)"