it's my first time using R. I did a panel data beta regression with logit link function (default). I tried clustered robust standard error and got an error as below:
> robust_se <- vcovCR(mixed_logit, cluster = data_used$id, type = "CR2")
Error in nobs0(x) * vcov0(x, ...) :
non-numeric argument to binary operator
Then I checked whether the number of observations and the variance-covariance matrix are numeric.
nobs(mixed_logit)
[1] 3544
str(vcov(mixed_logit))
List of 1
$ cond: num [1:9, 1:9] 6.69e-02 1.45e-04 -3.86e-06 9.66e-05 -3.37e-03 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : chr [1:9] "(Intercept)" "female" "fparl" "fisc_indep" ...
.. ..$ : chr [1:9] "(Intercept)" "female" "fparl" "fisc_indep" ...
- attr(*, "class")= chr [1:2] "vcov.glmmTMB" "matrix"
From the results, (1) is the problem coming from vcov(model)? Because the numeric is in the list. (2) How to solve this problem? It is using glmmTMB package. Thank you
it's my first time using R. I did a panel data beta regression with logit link function (default). I tried clustered robust standard error and got an error as below:
> robust_se <- vcovCR(mixed_logit, cluster = data_used$id, type = "CR2")
Error in nobs0(x) * vcov0(x, ...) :
non-numeric argument to binary operator
Then I checked whether the number of observations and the variance-covariance matrix are numeric.
nobs(mixed_logit)
[1] 3544
str(vcov(mixed_logit))
List of 1
$ cond: num [1:9, 1:9] 6.69e-02 1.45e-04 -3.86e-06 9.66e-05 -3.37e-03 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : chr [1:9] "(Intercept)" "female" "fparl" "fisc_indep" ...
.. ..$ : chr [1:9] "(Intercept)" "female" "fparl" "fisc_indep" ...
- attr(*, "class")= chr [1:2] "vcov.glmmTMB" "matrix"
From the results, (1) is the problem coming from vcov(model)? Because the numeric is in the list. (2) How to solve this problem? It is using glmmTMB package. Thank you
As @Roland commented, clubSandwich::vcovCR
does not support glmmTMB
fits. The proximal problem that causes the error would be easy to fix: glmmTMB::vcov()
returns a list of covariance matrices (for the conditional, zero-inflation, and dispersion submodels), so trying to multiply by it leads to multiplying a numeric value and a list ... but that's not the biggest problem.
There are going to be several barriers to implementing this support:
nobody has yet worked out small-sample corrected CRVE for GLMMs (if you know of relevant work, please point me to it!). Even the notion of basic cluster-robust SEs in GLMMs is a bit fuzzy---it seems like one can certainly compute sandwich estimators for GLMMs, but what forms of model misspecification are they robust to?
(that is, support for mixed models in clubSandwich
is limited to LMMs)
The mixed models task view lists clubSandwich
, merDeriv
, mlmhelpr
, glmmrBase
as possibilities for robust variance-covariance matrices from mixed models; I don't know which (if any) support GLMMs and/or glmmTMB
.
You might need to ask for more help on Cross Validated on this one (i.e., "how do I get robust var-cov matrices for a random-effects panel beta regression?")
clubSandwich::vcovCR
? glmmTMB fits don't seem to be listed as supported in the documentation. – Roland Commented Jan 30 at 6:40