2

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.

a_m_mac
  • 21
  • 1
  • there is code [here](https://github.com/cran/car/blob/master/R/Anova.R#L1719-L1725) that looks weird to me - it basically says to override the user-specified `vcov.` ?? I might check with the author/maintainer ... – Ben Bolker Jun 11 '21 at 15:25
  • Yes, that's exactly the bit I was looking at - I think there shouldn't be a '!' at the start? Thanks Ben for a fast response! – a_m_mac Jun 11 '21 at 15:32
  • as I said, it looks weird to me to. But since there are no comments about why it might or might not be there, I would want to check with the author ... https://en.wikipedia.org/wiki/G._K._Chesterton#Chesterton's_fence – Ben Bolker Jun 11 '21 at 16:28
  • Thank you, very nice advice. I've been in touch with the authors who are looking into it. It is similar to a bug in the function for 'lm' they tell me, related to a recent update. Thanks again for looking at it. – a_m_mac Jun 14 '21 at 08:31

0 Answers0