3

Most of the answers I found say "look at the residual plots". Which is great!

But I have a large set of curves, and would like to "distinguish" time series curves that fit a model without bias in the residuals. For example, testing whether curves are mostly "white noise" and fit a model like y = constant_mean + random_noise .

Examples

In the following example time series, a polynomial fit does not give biased residuals:

enter image description here

enter image description here

And, as expected, a linear fit does have biased residuals:

enter image description here

How can i test for bias in the residuals?

Is there a correct way of doing this? Or any thoughts?

Mine so far include:

Looking for a test similar to heteroscedasticity, but for the mean of the residuals.

Maybe some kind of sliding window scan, of the residuals of a linear fit with null slope. In that case perhaps the "distributions of means" over all time windows (continuous subsets) must be the same across all windows then there is no bias. For example, that should be the case in curves of this appearance:

enter image description here

I've also seen some suggestions for using auto-correlation, "serial correlation" or a "white noise test" for the residuals may work (see comments).

Use case

I have many curves, and i would like to find which of them fit noisy (flat|straight) lines and which do not. Or at least rank my curves in some way.

Thanks!

6
  • what does 'mostly white noise" mean.:) There are tests if a model is white noise or not. The issue here btw is serial correlation not bias as I understand that term. I don't think that something that is not white noise is biased.
    – user54285
    Commented Aug 26, 2020 at 23:53
  • Hi thanks for replying! by white noise i mean "random fluctuations around a mean value". What are the tests for that?
    – Naiky
    Commented Aug 27, 2020 at 14:59
  • I had not heard of "serial correlation" but it seems that it is the same as autocorrelation. How would you use that to approach the question?
    – Naiky
    Commented Aug 27, 2020 at 15:01
  • "not white noise" will have biased residuals if the model is linear and the data is not, right? If i tried to fit a straight line to data 3000000230, the residuals of the fit would be biased.
    – Naiky
    Commented Aug 27, 2020 at 15:03
  • serial correlation includes MA patterns I believe while I think autocorrelation is only AR patterns - although I could be wrong at that. There are many tests for white noise - which is the absence of AR and MA effects. In ARIMA Ljung Box tests for this. In regression I think Breusch-Godfrey is preferred because their are doubts about of the validity of Ljung Box. This link from this board is useful in that light. stats.stackexchange.com/questions/148004/…
    – user54285
    Commented Aug 27, 2020 at 20:55

1 Answer 1

1

for the DHARMa::plotResiduals function, my current solution to detecting patterns / bias in the residuals is to use test for the significance of a 0.5 quantile regression (package qgam) from the null expectation, which would be a flat line at 0 in your case.

In principle, you could use the DHARMa function directly on your residuals, however, it assumes that residuals are scaled between 0 and 1, so in your case, so you would first have to calculate DHARMa residuals from your model. The alternative is to fit a qgam models on your residuals by hand.

1
  • Thank you Florian, It might take a while but I will look into your solution and come back.
    – Naiky
    Commented Jan 23, 2021 at 5:04

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.