0

In R, we can use the build-in function lm() for linear regresson. However, we also use the lqs() function from packages MASS, and the rq() function from the packages quantreg. It seems like rq() calculates the quantile according to the R documentation, but what do they exactly calculating?

GarlicSTAT
  • 179
  • 1
  • 9
  • Does this answer your question https://stats.stackexchange.com/questions/160354/how-does-quantile-regression-work ? – Tim Jan 26 '20 at 22:36
  • I don’t know the MASS function, but quantile regression predicts conditional quantile (such as median), as opposed to OLS, which calculates a conditional mean. If this business about a conditional mean is news to you, do say so. That’s a critical point about regression that often gets skipped or forgotten. – Dave Jan 26 '20 at 22:37
  • @Tim what about the `lqs()` ? what kind of regression is the function doing? I can't find it in the R documentation. :( – GarlicSTAT Jan 26 '20 at 22:40
  • @Dave so is quantile regression better than linear regression? – GarlicSTAT Jan 26 '20 at 22:41
  • You’ve just opened up a major can of worms with that question. Like pretty much everything in statistics, blindly calling a method “better” is a bit too simple. Quantile regression has some nice robustness, such as if you have an outlier in your days that drags the trend line away from where it looks like it should be. On the other hand, it is not as efficient, meaning that you need more data. Also, that outlier might not be something you really want to dismiss. It will depend on what you want to do and what assumptions you’re making. – Dave Jan 26 '20 at 22:47
  • Also, I found lqs documentation here: https://www.rdocumentation.org/packages/MASS/versions/7.3-51.5/topics/lqs. – Dave Jan 26 '20 at 22:50

0 Answers0