Joint hypothesis test for quantile regression in R I am new to quantile regression and, currently, I am reading a paper that reports results of an F-test for a linear median (quantile) regression. The model is easy and a minimal working example in R would be as follows:
## generate some data
s <- rbeta( 100, 0.6, 2 )
x <- rbeta( 100, 2, 5 )
data <- as.data.frame( cbind( s, x ) )

## linear median regression
require(rms)
quant.model <- Rq( s ~ x, tau = 0.5, data = data )

Apparently, the F-test reported in that paper tests the joint hypothesis that the estimated coefficient of the intercept is zero and the estimated coefficient of x is 1 ($\beta_0 = 0$, $\beta_1 = 1$). And this is where I am stuck. I have no idea how I would set up such a test in R (as linearHypothesis() does not work with quantile regressions).
I have scoured the internet to the best of my capabilities and found this helpful post, which uses the anova function from the rms package I believe. However, the joint test in that post only tests for a combination of coefficients to be jointly zero.
For now, I have no idea how to set up a test for the joint hypothesis $H_0$: $\beta_0 = 0$, $\beta_1 = 1$. Could you point me in the right direction, please?
Cheerio!
 A: After some more searching and frustration, I decided to just do the F-test manually (and in a quick and dirty way). Here is how, in case some poor soul will have the same problem at some point in time.
First, I wrote a function to manually calculate an F-test for simple linear regression models.
##     manual F-test for linear hypothesis testing
##     requires the unrestricted and the restricted model
manual_LHT <- function(mod_u, mod_r){
  # --- get variables
  #     sum of sqared residuals
  SSR_u <- sum(unname(mod_u$residuals)^2)
  SSR_r <- sum(unname(mod_r$residuals)^2)
  #     number of restrictions (i.e., difference in residual degrees of freedom)
  q <- mod_r$df.residual - mod_u$df.residual
  #     number of regressors in unsrestricted model
  k <- dim(mod_u$model)[2] - 1
  #     number of observations
  n <- length(mod_u$residuals)
  
  # --- calculate F statistic
  nominator <- (SSR_r - SSR_u)/q
  denominator <- SSR_u/(n - k - 1)
  F_val <- nominator/denominator
  
  # --- calcuate p-value
  p_val <- pf(F_val, q, (n - k - 1), lower.tail = FALSE)
  return(list(Fval = F_val, pval = p_val))
}

Second, I did a little sanity check using this standard example.
library(AER)
library(MASS)
data("CASchools")

CASchools$size <- CASchools$students/CASchools$teachers
CASchools$score <- (CASchools$read + CASchools$math)/2
CASchools$expenditure <- CASchools$expenditure/1000

model <- lm(score ~ size + english + expenditure, data = CASchools)
model.restricted <- lm(score ~ english, data = CASchools)

linearHypothesis(model, c("size=0", "expenditure=0"))
manual_LHT(mod_u = model, mod_r = model.restricted)

Both linearHypothesis() and manual_LHT() lead to the same results regarding F-statistic and p-value. Console output for the former:
> linearHypothesis(model, c("size=0", "expenditure=0"))
Linear hypothesis test

Hypothesis:
size = 0
expenditure = 0

Model 1: restricted model
Model 2: score ~ size + english + expenditure

  Res.Df   RSS Df Sum of Sq      F   Pr(>F)    
1    418 89000                                 
2    416 85700  2    3300.3 8.0101 0.000386 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Console output for the latter.
> manual_LHT(mod_u = model, mod_r = model.restricted)
$Fval
[1] 8.010125

$pval
[1] 0.0003859748

Now, one important thing is to adapt the manual_LHT() function to the specifics of the regression model object. Specifically regarding quantile regressions with quantreg, the residual degrees of freedom can be obtained from summary(mod_r)$rdf instead of mod_r$df.residual like it is now in manual_LHT(). So, pay attention to this little adaptation requirement.
I am happy for any feedback. Maybe going this way is a big blunder. ;)
