# How to implement an iterative unit root test Classic List Threaded 6 messages Open this post in threaded view
|

## How to implement an iterative unit root test

 Hello, How can an interative unit root test be implemented in R? More specifically, given a time series, I wish to perform the Dickey Fuller Test on a daily basis for say the last 100 observations. It would be interative in the sense that this test would be repeated each day for the last 100 observations. Given the daily Dickey Fuller estimates of delta for the autoregressive process d(Y(t)) = delta * Y(t-1) + u(t) , the significance of delta would be computed. If possible, I would like to extract that value and record it in a table, that is a table containing the tau-values of a each day's calculations. How can such a test be done in R? More specifically, how can it be programmed to iteratively perform the test and also how to extract the t-values on a daily basis? Thank you. Sincerely, Bernd Dittmann ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Open this post in threaded view
|

## Re: How to implement an iterative unit root test

 Does this get you started? library(tseries) ?adf.test foo <- matrix(rnorm(1000),ncol=10,nrow=100) bar <- apply(foo,2,adf.test) sapply(bar, "[[", "statistic") sapply(bar, "[[", "p.value") HTH, Andy -----Original Message----- From: [hidden email] [mailto:[hidden email]] On Behalf Of Bernd Dittmann Sent: Wednesday, April 05, 2006 8:58 PM To: [hidden email] Subject: [R] How to implement an iterative unit root test Hello, How can an interative unit root test be implemented in R? More specifically, given a time series, I wish to perform the Dickey Fuller Test on a daily basis for say the last 100 observations. It would be interative in the sense that this test would be repeated each day for the last 100 observations. Given the daily Dickey Fuller estimates of delta for the autoregressive process d(Y(t)) = delta * Y(t-1) + u(t) , the significance of delta would be computed. If possible, I would like to extract that value and record it in a table, that is a table containing the tau-values of a each day's calculations. How can such a test be done in R? More specifically, how can it be programmed to iteratively perform the test and also how to extract the t-values on a daily basis? Thank you. Sincerely, Bernd Dittmann ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide! http://www.R-project.org/posting-guide.html______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Open this post in threaded view
|

## Re: How to implement an iterative unit root test

 Thank you for your suggestion, Andy. Luckily, the fMultivar package has already implemented such a "rolling" function: "rollFun". Thus I tried the following: myfunction <- function(x, n = 5) {     rollFun(x = x, n = n, FUN = adfTest) } This however does not return the tau values (or alternatively, the p.values) I am looking for. How do I need to define the function FUN to obtain these values? Many thanks! Sincerely, Bernd Andy Bunn schrieb: > Does this get you started? > > library(tseries) > ?adf.test > foo <- matrix(rnorm(1000),ncol=10,nrow=100) > bar <- apply(foo,2,adf.test) > sapply(bar, "[[", "statistic") > sapply(bar, "[[", "p.value") > > > HTH, Andy > > -----Original Message----- > From: [hidden email] > [mailto:[hidden email]] On Behalf Of Bernd Dittmann > Sent: Wednesday, April 05, 2006 8:58 PM > To: [hidden email] > Subject: [R] How to implement an iterative unit root test > > > Hello, > > How can an interative unit root test be implemented in R? > More specifically, given a time series, I wish to perform the Dickey > Fuller Test on a daily basis for say the last 100 observations. It would > be interative in the sense that this test would be repeated each day for > the last 100 observations. > Given the daily Dickey Fuller estimates of delta for the autoregressive > process > > d(Y(t)) = delta * Y(t-1) + u(t) > > , the significance of delta would be computed. If possible, I would like > to extract that value and record it in a table, that is a table > containing the tau-values of a each day's calculations. > > > How can such a test be done in R? More specifically, how can it be > programmed to iteratively perform the test and also how to extract the > t-values on a daily basis? > > > Thank you. > > Sincerely, > > Bernd Dittmann > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help> PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html> > > ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Open this post in threaded view
|