balipour

Durbin Watson Test Statistic [pig]

In statistics, the Durbin–Watson statistic is a test statistic used to detect the presence of autocorrelation at lag 1 (AR(1) process) in the residuals (prediction errors) from a regression analysis. With the new array function tradingview implemented, we are able to do our calculations on the residuals.

The residual is given by subtracting the actual value (in this case it's log returns) from the prediction value (generated by linear regression ). The following chart displays who we get the error term from the regression.
Then we do our calculation based on the residuals. The formula is basically sum of squared of the difference between error and it's 1 lagged term divided by sum of squared of all the error terms. It's a very simple test on residual sum of squares. The value you get is from 0 to 4.
When DW > 2, there's a possible negative autocorrelation.
When DW < 2, there's a possible positive autocorrelation.
Note: above 2 and below 2 is only possible autocorrelation, it might not be statistically significant.

If we want to know if the autocorrelation presence is significant or not. We need a Durbin Watson Stats Table. Based on the lookback period you use, you can find the critical value on the table (usually the first column).
Durbin Watson 0.05 Table
For the default setting 30 lookbacks, the 5% critical level for positive autocorrelation is 1.35. (We round to 1.4 on the default setting for convenience ). The other side for negative autocorrelation is just 4 - 1.35 = 2.65 due to its symmetry. For other lookbacks like 50, the critical value is 1.5 and 2.5, we just need to check the table to find the corresponding value. The user only has to find the lower threshold, the indicator will automatically give you the 4- lower threshold value on the other side.

As we have mentioned in the autocorrelation function and Hurst exponent . Positive autocorrelation means positive returns are more likely to be followed by positive returns and negative returns are more likely to be followed by negative returns. People may call it trending. Negative autocorrelation means positive returns are more likely to be followed by negative returns and negative returns may be followed by positive returns. People may call it mean-reverting.
The Durbin Watson test only tests the first-order autocorrelation. But there might also be significant autocorrelation in other lagged values. You can see the autocorrelation of other lags in our ACF.
We may also publish more advanced autocorrelation tests in the future.
Notas de prensa: A typo in graph one displaying the error as distance between the points and the regression line. "E5" should be "E3".
Notas de prensa: Implemented 0.05 Significance Dubrin Watson Statistics Table in the code. No need to check the table or type in the critical value. The value will be automatically adjusted according to the lookback period.

Changed the color theme.

White means DW > 2, possible - autocorrelation / mean reversion
Orange means DW < 2, possible + autocorrelation / trending

Blue background means DW > upper critical value, Significant - autocorrelation / mean reversion
Red background means DW < lower critical value, Significant + autocorrelation / trending

Eliminar de Scripts favoritos. Añadir a Scripts favoritos.
Our Website: https://bapigindicator.com

Sign up on our website to get access to our indicators.

Comentarios

This publication is now featured in our Editors' Picks. In the name of all TradingView traders, thank you for your valuable contribution to the TradingView community, and congrats!
+10 Responder
balipour PineCoders
@PineCoders, I was trying to find where I was saying there should be another word for “help” that actually helps. And that’s all you guys have done for us every single time there was an opportunity. So I want to thank you for being great and providing the greatest platform to allow us to do what we do. Thank you.
+7 Responder
PineCoders balipour
@balipour, Thx for the good words. Appreciate. Without exceptional creations such as yours, there would be nothing for us to select for Editors' Picks, so thanks to you guys for your work, and for sharing it open-source.
+4 Responder
balipour PineCoders
@PineCoders, far too kind.
+3 Responder
Sexy
+9 Responder
balipour DairyMilk
@DairyMilk, one person gets it lol.
+1 Responder
Just waking up, what a post B-Day surprise. BaliPig bringing the heat as usual, you 2 guys are setting the standard in the Math revolution. Say goodbye to outdated indicators and hello to Better Math.
Mafffs McBagginz approves, 2 thumbs up from the Discord @ POWB.......
+6 Responder
balipour CryptoCYCLOPS
@CryptoCYCLOPS, Happy Birthday my man. Least we could do, lol.
+1 Responder
Awesomeness!

Thanks Bali/Pig!
+3 Responder
balipour SemiQuasi
@SemiQuasi, anytime. Thanks a lot.
+1 Responder
Inicio Analizador de acciones Analizador de Forex Crypto Screener Calendario económico Cómo funciona Funcionalidades del gráfico Precios Recomendar a un amigo Normas Centro de ayuda Soluciones broker y sitio web Widgets Soluciones gráficas Biblioteca de gráficos ligeros Blog y Noticias Twitter
Perfil Opciones de configuración del perfil Cuenta y facturación Amigos referidos Monedas Mis solicitudes de asistencia Centro de ayuda Ideas publicadas Seguidores Siguiendo Mensajes privados Chat Cerrar sesión