I’d like to test for equality between two regression coefficients, one of which is an interaction term. I’ve been referencing Andrew P. Wheelers statistics blog: https://andrewpwheeler.com/2016/10/19/testing-the-equality-of-two-regression-coefficients/
From what I understand, I can calculate the difference in the regression coefficients and the standard error of that difference using the variance-covariance matrix. Then, apply the SE to the difference estimate to see if it is greater than zero. If it is, then the coefficients are significantly different. However, I'm stuck on the equation used to calculate the standard error of the difference because one of the regression coefficients is an interaction term.
I'm interested in calculating the difference between the regression coefficients day and wolf:day from the model output below.
Time is a 3-level categorical variable (Day, Crepuscular and Night, Night is the reference level); Wolf is a 2 level categorical variable (a=wolves absent, b= wolves present)
Is the below equation for the standard error of the difference between the regression coefficients day and wolf:day correct? The variance-covariance matrix is below the model output.
SE_Diff = sqrt(Variance(wolf:day) + Variance(day)) – 2*Covariance(wolf:day, day))
Do I also add in Variances and Covariances for wolf since there is an interaction term?
I'm running a zero-inflated Poisson generalized linear mixed model with the R package glmmtmb.
> summary(cougar_temporal_3_cat_time)
Family: poisson ( log )
Formula: CougarActivity ~ (1 | location_id) + wolf_presence * time + offset(log(day))
Zero inflation: ~1
Data: data
AIC BIC logLik deviance df.resid
4295.9 4380.3 -2140.0 4279.9 280568
Random effects:
Conditional model:
Groups Name Variance Std.Dev.
location_id (Intercept) 0.4079 0.6387
Number of obs: 280576, groups: location_id, 64
Conditional model:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -3.72379 0.72801 -5.115 3.14e-07 ***
wolf -0.05832 0.26123 -0.223 0.82333
timecrepus 0.59630 0.21126 2.823 0.00476 **
timeday -0.40524 0.21662 -1.871 0.06138 .
wolf:timecrepus 0.19332 0.29788 0.649 0.51636
wolf:timeday 0.53635 0.29287 1.831 0.06705 .
##Variance-covariance matrix
vcov(cougar_temporal_3_cat_time, full=FALSE)
Conditional model:
(Intercept) wolf_presenceb time_3_catcrepus time_3_catday wolf_presenceb:time_3_catcrepus
(Intercept) 0.52999833 -0.03298061 -0.01836126 -0.01862785 0.01793521
wolf_presenceb -0.03298061 0.06824002 0.01881935 0.01882303 -0.03951061
time_3_catcrepus -0.01836126 0.01881935 0.04463025 0.01883163 -0.04463059
time_3_catday -0.01862785 0.01882303 0.01883163 0.04692288 -0.01883176
wolf_presenceb:time_3_catcrepus 0.01793521 -0.03951061 -0.04463059 -0.01883176 0.08873388
wolf_presenceb:time_3_catday 0.01723512 -0.03951691 -0.01883286 -0.04692339 0.03953483
wolf_presenceb:time_3_catday
(Intercept) 0.01723512
wolf_presenceb -0.03951691
time_3_catcrepus -0.01883286
time_3_catday -0.04692339
wolf_presenceb:time_3_catcrepus 0.03953483
wolf_presenceb:time_3_catday 0.08577567
Zero-inflation model:
zi~(Intercept)
zi~(Intercept) 0.6410403
```