Connor_84
Connor_84

Reputation: 1

anova output blank when run on lmer model

I'm trying to run an anova model using the lme4 library. I don't have any real data, so I just yanked the Cars93 data from MASS. While I could get lmer(...) to work, I can't seem to get the anova table to print.

Here's what happened:

> library(MASS)

> cars <- Cars93

> library(lme4)
Loading required package: Matrix
Loading required package: lattice

Attaching package: ‘lme4’

The following object(s) are masked from ‘package:stats’:

AIC, BIC

> fit <- lmer(Max.Price ~ 1+(1|AirBags)+(1|Man.trans.avail), data=cars)
> anova(fit)
Analysis of Variance Table
Df Sum Sq Mean Sq F value   
> summary(fit)
Linear mixed model fit by REML 
Formula: Max.Price ~ 1 + (1 | AirBags) + (1 | Man.trans.avail) 
Data: cars 
AIC   BIC logLik deviance REMLdev
688 698.1   -340    685.1     680
Random effects:
Groups          Name        Variance Std.Dev.
AirBags         (Intercept) 62.2339  7.8888  
Man.trans.avail (Intercept)  6.3022  2.5104  
Residual                    83.2786  9.1257  
Number of obs: 93, groups: AirBags, 3; Man.trans.avail, 2

Fixed effects:
            Estimate Std. Error t value
(Intercept)    23.81       5.00   4.761

Any help or suggestions would be greatly appreciated.

Upvotes: 0

Views: 1183

Answers (1)

Cossutta
Cossutta

Reputation: 31

I think you need a variable in your formula for anova to work. For example

fit <- lmer(Max.Price ~ Weight + (1 | AirBags) + (1 | Man.trans.avail),data=cars)

anova(fit)
Analysis of Variance Table
       Df Sum Sq Mean Sq F value
Weight  1 1932.1  1932.1   29.67

Upvotes: 1

Related Questions