Can anyone suggest a way to construct confidence bands on a particular quantile regression line? I am working with the quantreg package in R.
Asked
Active
Viewed 134 times
2
2 Answers
0
The function predict.rq is analogous in use and meaning to predict.lm (both can be called by simply using predict). I could not get this to return a useful result using the default fitted values (it returns a vector instead of a matrix). My workaround was to define a newdata dataframe consisting of the fitted values and specifying that in the call to predict.rq.
Thomas
- 1,071
0
To mimic the behavior of predict.lm() with default newdata one can use:
predict(mf, newdata = data.frame(x = mf$x, y = fitted(mf)), interval = "confidence")
assuming mf is the value returned by rq(), i.e., the fitted model object, and that the response variable was called y and the independent variable x in the data used to fit mf.
Pedro Aphalo
- 101
summary()around yourrqobject and it should give you upper and lower bands. – JustGettinStarted Jan 15 '19 at 19:24