Skip to contents

Extract the fixed-effects estimates

Arguments

object

any fitted model object from which fixed effects estimates can be extracted.

Value

a named, numeric vector of fixed-effects estimates.

Details

Extract the estimates of the fixed-effects parameters from a fitted model.

Examples

  # \donttest{
  library(lme4)
#> 
#> Attaching package: 'lme4'
#> The following objects are masked from 'package:actuaRE':
#> 
#>     fixef, ranef
#> The following objects are masked from 'package:cplm':
#> 
#>     VarCorr, fixef, ranef
  fixef(lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject), sleepstudy))
#> (Intercept)        Days 
#>   251.40510    10.46729 
  fm2 <- lmer(Reaction ~ Days + Days2 + (1|Subject),
              data=transform(sleepstudy,Days2=Days))
#> fixed-effect model matrix is rank deficient so dropping 1 column / coefficient
  fixef(fm2,add.dropped=TRUE)
#> (Intercept)        Days       Days2 
#>   251.40510    10.46729          NA 
  ## first two parameters are the same ...
  stopifnot(all.equal(fixef(fm2,add.dropped=TRUE)[1:2],
                      fixef(fm2)))
  # }