a_m_mac
a_m_mac

Reputation: 21

User specified variance-covariance matrix in car::Anova not working

I am trying to use the car::Anova function to carry out joint Wald chi-squared tests for interaction terms involving categorical variables.

I would like to compare results when using bootstrapped variance-covariance matrix for the model coefficients. I have some concerns about the normality of residuals and am doing this as a first step before considering permutation tests as an alternative to joint Wald chi-squared tests.

I have found the variance covariance from the model fitted on 1000 bootstrap resamples of the data. The problem is that the car::Anova.merMod function does not seem to use the user-specified variance covariance matrix. I get the same results whether I specify vcov. or not.

I have made a very simple example below where I try to use the identity matrix in Anova(). I have tried this with the more realistic bootstrapped var-cov as well.

I looked at the code on github and it looks like there is a line where vcov. is overwritten using vcov(mod), so that might be an error. However I thought I'd see if anyone here had come across this issue or could see if I had made a mistake.

Any help would be great!

df1 = data.frame( y = rbeta(180,2,5), x = rnorm(180), group = letters[1:30] )

mod1 = lmer(y ~ x + (1|group), data = df1)

# Default, uses variance-covariance from the model
Anova(mod1)

# Should use user-specified varcov matrix but does not - same results as above
Anova(mod1, vcov. = diag(2))

# I'm not bootstrapping the var-cov matrix here to save space/time

p.s. Using car::linearHypothesis works for user-specified vcov, but this does not give results using type 3 sums of squares. It is also more laborious to use for more than one interaction term. Therefore I'd prefer to use car::Anova if possible.

Upvotes: 2

Views: 264

Answers (0)

Related Questions