Koenker and Machado$^{[1]}$ describe $R^1$, a local measure of goodness of fit at the particular ($\tau$) quantile.
Let $V(\tau) = \min_{b}\sum \rho_\tau(y_i-x_i'b)$
Let $\hat{\beta}(\tau)$ and $\tilde{\beta}(\tau)$ be the coefficient estimates for the full model, and a restricted model, and let $\hat{V}$ and $\tilde{V}$ be the corresponding $V$ terms.
They define the goodness of fit criterion $R^1(\tau) = 1-\frac{\hat{V}}{\tilde{V} }$.
Koenker gives code for $V$ here,
rho <- function(u,tau=.5)u*(tau - (u < 0))
V <- sum(rho(f$resid, f$tau))
So if we compute $V$ for a model with an intercept-only ($\tilde{V}$ - or V0
in the code snippet below) and then an unrestricted model ($\hat{V}$), we can calculate an R1 <- 1-Vhat/V0
that's - at least notionally - somewhat like the usual $R^2$.
Edit: In your case, of course, the second argument, which would be put in where f$tau
is in the call in the second line of code, will be whichever value of tau
you used. The value in the first line merely sets the default.
'Explaining variance about the mean' is really not what you're doing with quantile regression, so you shouldn't expect to have a really equivalent measure.
I don't think the concept of $R^2$ translates well to quantile regression. You can define various more-or-less analogous quantities, as here, but no matter what you choose, you won't have most of the properties real $R^2$ has in OLS regression. You need to be clear about what properties you need and what you don't -- in some cases it may be possible to have a measure that does what you want.
--
$[1]$ Koenker, R and Machado, J (1999),
Goodness of Fit and Related Inference Processes for Quantile Regression,
Journal of the American Statistical Association, 94:448, 1296-1310