I am using quantile regression to estimate the effect of a categorical variable AG_SEP2 on a response outcome ScoreGSA according to the distribution of this outcome variable, while adjusting on other variables.
quantreg <- rq(ScoreGSA ~ AG_SEP2 + Sexe + Jumeau + ZS_POIDS_NAIS_Cat + CMU + CSPTOT, method="fn", c(0.2,0.5,0.8), data=SepGSA) a <- summary(quantreg, se="boot", R=500, cov=TRUE)
AG_SEP2 is a 4-class categorical variable, so I get the following output:
Coefficients: tau= 0.2 tau= 0.5 tau= 0.8 (Intercept) 4.800000e+01 5.400000e+01 5.800000e+01 AG_SEP2AG3234_SEP1 9.907373e-11 1.000000e+00 1.000000e+00 AG_SEP2AG2431_SEP0 -2.000000e+00 -2.000000e+00 -1.000000e+00 AG_SEP2AG2431_SEP1 -7.000000e+00 -5.000000e+00 -2.000000e+00 ...
Now, I would like to test whether two coefficients within a class of AG_SEP2 variable are different or not using Wald test. For example, within the class "AG2431_SEP1", does -7 at tau=0.2 is different from -2 at tau=0.8 ? To do so, I use the following formula: W = (beta1 - beta2) / (var(beta1) + var(beta2) - 2*cov(beta1,beta2))
My question is: I can get the covariance between coefficients for a given tau with the following code:
but how can I get the covariance between coefficients within different tau, for example between tau=0.2 and tau =0.8?