[R] Anova() in car not works after loading piecewiseSEM package

Jinsong Zhao j@zh@o @end|ng |rom ye@h@net
Sun Jul 19 03:06:21 CEST 2026


Hi there,

In the code below, you may notice that the Anova() function from the 
*car*package does not behave as expected after loading the 
piecewiseSEMpackage. I haven't been able to identify the cause of this 
issue or find a working solution. Any suggestions or insights would be 
greatly appreciated.

Best,

Jinsong

 > library(nlme)
 > fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1)
 > library(car)
Loading required package: carData
 > Anova(fm2)
Analysis of Deviance Table (Type II tests)

Response: distance
        Chisq Df Pr(>Chisq)
age 114.8383  1  < 2.2e-16 ***
Sex   9.2921  1   0.002301 **
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
 > library(piecewiseSEM)
Registered S3 method overwritten by 'lme4':
   method           from
   na.action.merMod car

   This is piecewiseSEM version 2.3.0.2.


   Questions or bugs can be addressed to <jslefche using gmail.com>.
 > Anova(fm2)
Error in if (random) { : the condition has length > 1

	[[alternative HTML version deleted]]



More information about the R-help mailing list