M. M. Palhoto N. Rodrigues
2004-Jan-13 20:37 UTC
[R] How can I test if a not independently and not identically distributed time series residuals' are uncorrelated ?
I'm analizing the Argentina stock market (merv) I download the data from yahoo library(tseries) Argentina <- get.hist.quote(instrument="^MERV","1996-10-08","2003-11-03", quote="Close") merv <- na.remove(log(Argentina)) I made the Augmented Dickey-Fuller test to analyse if merv have unit root: adf.test(merv,k=13) Dickey-Fuller = -1.4645, p-value = 0.805, merv have unit root than diff(merv,1) is stationary. Than I made Breushch-Pagan test to test if residuals are identically distributed: library(lmtest) bptest(merv[2:1730]~-1+merv[1:1729],~merv[1:1729]+I(merv[1:1729])^2) BP = 81.3443, df = 2, p-value = < 2.2e-16 So merv.reg$resid aren't identically distributed. Than merv is heteroscedastik. Finally I made Box-Ljung test to test if residuals are independently distributed: (H0: merv.reg$resid are independently distributed) library(ts) merv.reg <- lm(merv[2:1730]~-1+merv[1:1729]) Box.test(merv.reg$resid, lag=25,type="Ljung") X-squared = 54.339, df = 25, p-value = 0.0006004 So, there is evidence to not reject the null hypothesis, than the residuals are independently distributed. Because the residuals are not independently distributed, we know that the squares of residuals are correlated: cov[(residuals_t)^2, (residuals_(t-k))^2] <> 0 (not zero for k <> 0) But, the residuals could be uncorrelated, (even when they are not independent distributed): cov[residuals_t, residual_(t-k)]=0 ! How can I test that merv.reg$residuals are uncorrelated ? Thanks a lot. [[alternative HTML version deleted]]
M. M. Palhoto N. Rodrigues
2004-Jan-14 10:55 UTC
[R] How can I test if a not independently and not identically distributed time series residuals' are uncorrelated ?
I'm analizing the Argentina stock market (merv) I download the data from yahoo library(tseries) Argentina <- get.hist.quote(instrument="^MERV","1996-10-08","2003-11-03", quote="Close") merv <- na.remove(log(Argentina)) I made the Augmented Dickey-Fuller test to analyse if merv have unit root: adf.test(merv,k=13) Dickey-Fuller = -1.4645, p-value = 0.805, merv have unit root than diff(merv,1) is stationary. Than I made Breushch-Pagan test to test if residuals are identically distributed: library(lmtest) bptest(merv[2:1730]~-1+merv[1:1729],~merv[1:1729]+I(merv[1:1729])^2) BP = 81.3443, df = 2, p-value = < 2.2e-16 So merv.reg$resid aren't identically distributed. Than merv is heteroscedastik. Finally I made Box-Ljung test to test if residuals are independently distributed: (H0: merv.reg$resid are independently distributed) library(ts) merv.reg <- lm(merv[2:1730]~-1+merv[1:1729]) Box.test(merv.reg$resid, lag=25,type="Ljung") X-squared = 54.339, df = 25, p-value = 0.0006004 So, there is evidence to not reject the null hypothesis, than the residuals are independently distributed. Because the residuals are not independently distributed, we know that the squares of residuals are correlated: cov[(residuals_t)^2, (residuals_(t-k))^2] <> 0 (not zero for k <> 0) But, the residuals could be uncorrelated, (even when they are not independent distributed): cov[residuals_t, residual_(t-k)]=0 ! How can I test that merv.reg$residuals are uncorrelated ? Thanks a lot. [[alternative HTML version deleted]]
M. M. Palhoto N. Rodrigues
2004-Jan-14 15:52 UTC
[R] How can I test if a not independently and not identically distributed time series residuals' are uncorrelated ?
Ok I made Jarque-Bera test to the residuals (merv.reg$residual) library(tseries) jarque.bera.test(merv.reg$residual) X-squared = 1772.369, df = 2, p-value = < 2.2e-16 And I reject the null hypotesis (H0: merv.reg$residual are normally distributed) So I know that: 1 - merv.reg$residual aren't independently distributed (Box-Ljung test) 2 - merv.reg$residual aren't indentically distributed (Breusch-Pagan test) 3 - merv.reg$residual aren't normally distributed (Jarque-Bera test) My questions is: It is possible merv.reg$residual be uncorrelated ? cov[residual_t, residual_(t+k)] = 0 ? Even when residuals are not independent distributed ! (and we know that they aren't normally distributed and they aren't indentically distributed ) And how can I tested it ? Thanks.> Hint, if a ts is normally distributed then independence anduncorrelatedness> are equivalent, hence you can test for normally distributed errors (e.g. > Jarque-Bera-Test). > > HTH, > Bernhard > > >
Adrian Trapletti
2004-Jan-15 10:08 UTC
[R] How can I test if a not independently and not identically distributed time series residuals' are uncorrelated ?
> > >I'm analizing the Argentina stock market (merv) >I download the data from yahoo > >library(tseries) >Argentina <- get.hist.quote(instrument="^MERV","1996-10-08","2003-11-03", quote="Close") > >merv <- na.remove(log(Argentina)) > >I made the Augmented Dickey-Fuller test to analyse >if merv have unit root: >adf.test(merv,k=13) >Dickey-Fuller = -1.4645, p-value = 0.805, >merv have unit root than diff(merv,1) is stationary. > >Than I made Breushch-Pagan test to test if residuals are identically distributed: >library(lmtest) >bptest(merv[2:1730]~-1+merv[1:1729],~merv[1:1729]+I(merv[1:1729])2) >BP = 81.3443, df = 2, p-value = < 2.2e-16 >So merv.reg$resid aren't identically distributed. Than merv is heteroscedastik. > >Finally I made Box-Ljung test to test if residuals are independently distributed: >(H0: merv.reg$resid are independently distributed) >library(ts) >merv.reg <- lm(merv[2:1730]~-1+merv[1:1729]) >Box.test(merv.reg$resid, lag=25,type="Ljung") >X-squared = 54.339, df = 25, p-value = 0.0006004 >So, there is evidence to not reject the null hypothesis, >than the residuals are independently distributed. >Palhoto, Box.test is a test, which tests for independence using the acf of a time series. That means the test is in fact a test for uncorrelatedness rather than independence. Applying Box.test to the squares of the residuals is testing for ARCH effects in the time series. With stock index data, usually the time series are uncorrelated, but show strong ARCH effects, ie., are not independent. Other tests for independence are bds.test and terasvirta.test from tseries. The former is a more general test for independence, the latter focuses on neglected non-linearity in the conditional mean (white.test is designed for the same, but I do not recommend it). With stock index data, usually the time series are not i.i.d. according to the bds.test due to ARCH effects. With terasvirta.test you find sometimes neglected non-linearity in the conditional mean. However, from my experience, this is often due to an exogenuous structural break and not due to endogenuous non-linearity in conditional mean. best Adrian>Because the residuals are not independently distributed, we know that the >squares of residuals are correlated: >cov[(residuals_t)2, (residuals_(t-k))2] <> 0 (not zero for k <> 0) > >But, the residuals could be uncorrelated, (even when they >are not independent distributed): >cov[residuals_t, residual_(t-k)]=0 ! >How can I test that merv.reg$residuals are uncorrelated ? > >Thanks a lot. > > > [[alternative HTML version deleted]] >-- Dr. Adrian Trapletti Trapletti Statistical Computing Wildsbergstrasse 31, 8610 Uster Switzerland Phone & Fax : +41 (0) 1 994 5631 Mobile : +41 (0) 76 370 5631 Email : mailto:a.trapletti at bluewin.ch WWW : http://trapletti.homelinux.com
Possibly Parallel Threads
- How can I test if a not independently and not identicallydistributed time series residuals' are uncorrelated ?
- How can I test if time series residuals' are uncorrelated ?
- how to specify uncorrelated random effects in nlme::lme()
- Uncorrelated random vectors
- Box-Ljung p-value -> Test for Independence