enter image description hereI have data which is non-linear, heteroscedastic and is spatially autocorrelated. The predictor and response are continuous variables. Quantile regression accounts for the heteroscedasticity but I am not sure how to account for the autocorrelation. As one of the assumptions for quantile regression is the independence of data points.

Any leads will be much appreciated on how to examine heteroskedastic and autocorrelated data?


I haven't considered robust estimator and will consider it.

More info regarding the model, I am regressing

Species_richness ~ Latitude + annual_precipitation + elevation

Currently, I am exploring this with the quantreg package in R. Can any of the methods be used for error estimation using this?

This thread suggests bootstrapping but unsure how it works. (Quantile regression) Which standard error for heteroscedasticity & serial correlation

  • $\begingroup$ Can you post more details about your problem? Heteroskedasticity and autocorrelation consistent (HAC) estimators such as sandwich estimators can probably address your need. I don't think quantile regression addresses either problem. $\endgroup$
    – mkt
    Commented Jun 26, 2022 at 11:13
  • $\begingroup$ See if a semiparametric model with a Markov process fits your needs - hbiostat.org/proj/covid19 and Chapter 14 of RMS. $\endgroup$ Commented Jun 26, 2022 at 11:30
  • $\begingroup$ You could apply "Newey-West Standard Errors" instead of the usual OLS standard errors. Newey-West SE method can address both Heteroscedasticity and autocorrelation. $\endgroup$ Commented Jun 26, 2022 at 12:28

1 Answer 1


Quantile regression is not especially efficient in its use of data, and there are other solutions to the problem of heteroscedasticity that are likely better in your case.

Specifically, you can fit your model as a standard linear regression, and then calculate heteroscedasticity- and autocorrelation-consistent (HAC) standard errors such as the Newey-West estimator. This can be done in R using the sandwich package.

  • $\begingroup$ Sure, but quantile regression is also useful in some way as one can examine the upper limit of a response given a predictor. It is also useful here as heteroscedasticity is less of a problem as only the quantile of the data is being examined. Thank you, I have been exploring and reading up on HAC. To deal with this dataset I think these are the methods one can do right? 1. GLM with a gamma distribution + sandwich estimator 2. glmrob with gamma 3. gls/gnls with HAC error 4. GAM (unsure about heteroskedasicity) 5. QGAM $\endgroup$
    – Abhinav
    Commented Jul 11, 2022 at 6:05
  • $\begingroup$ This answer addresses the two challenges you specified in your initial question: heteroscedasticity and autocorrelation. The new edits & subquestions change things considerably and it might be better if you posted a new question focussing on those. $\endgroup$
    – mkt
    Commented Jul 11, 2022 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.