16

There are many different methods for this. Most people rely on a unit root test. Rmetrics has collected the most common unit root tests into the fUnitRoots package, which primarily provides a wrapper for Bernhard Pfaff's urca package. These include: Augmented Dickey–Fuller (ADF) test Elliott–Rothenberg–Stock test KPSS unit root test Phillips–Perron ...


12

There are a number of different tests that are generally used to compare samples to different distributions, such as Jarque-Bera, Anderson-Darling, and Kolmogorov–Smirnov (see this related question). In your case, with just the standard deviation and mean, there isn't a whole lot to say. You need to assume a distribution (e.g. normal). You would be able ...


10

You can use the (Adjusted) Dickey Fuller Test: http://en.wikipedia.org/wiki/Dickey%E2%80%93Fuller_test I'm pretty sure your software package has a library or routine you can use to do it.


9

The main problem in your code is this line: rowSums(coef(model) * frame[, -1]) I'm not sure exactly what is does, perhaps some matrix multiplication, but definitely not what you expect it to do. Try to replace it with manual multiplication spread <- frame[,1] - (coef(model)[1]*frame[,2] + coef(model)[2]*frame[,3] + coef(model)[3]*frame[,4] + coef(...


8

I will assume a white noise is a process $(\varepsilon_t)$ with zero mean, no autocorrelation and constant variance $\sigma^2 > 0$ while a random walk is a process $(x_t)$ defined by $$ x_{t+1} = x_t + \varepsilon_{t+1} $$ where $\varepsilon$ is a white noise. 1) No since $Var(x_{t+1}) = Var(x_t) + Var(\varepsilon_{t+1})$ is stricly increasing while ...


7

There is a lot of ways to understand why stationarity allows to apply usual time series analysis. Here is one more. Very often, the theoretical justification of what you do in time series need to be able to identify the mean formula and the expectation: $$\frac{1}{N}\sum_{n=1}^N X_n \underset{N\rightarrow +\infty}{\longrightarrow} \mathbb{E} X, $$ where the ...


6

Be careful, remember that the mean and the standard deviation don't tell you the whole story: http://en.wikipedia.org/wiki/Anscombe%27s_quartet


6

Yet another alternative are wavelet based tests. With comparable size, they often have higher power, especially for very near unit root alternatives. An example is here (free pre-print versions of this paper are available, too).


6

To simplify, consider the errors rather than the returns. The variance is effectively the average of the squared errors, while absolute deviation is the average of the absolute errors. So plotting the squared errors or absolute errors over time could give an indication of whether the variance or absolute deviation is constant over time. Since variance is ...


5

In terms of interpretation, an $MA$ model simply means that the time series is a function of the error from previous periods. You might find it informative to consider plotting simple $AR(1)$ models alongside various $ARMA(1,1)$ to develop a more intuitive understanding. For instance, the $AR(1)$ model (chosen as it is common for financial time series) $$x_{...


5

To quote Wikipedia: In mathematics, a stationary process (or strict(ly) stationary process or strong(ly) stationary process) is a stochastic process whose joint probability distribution does not change when shifted in time. Consequently, parameters such as the mean and variance, if they are present, also do not change over time and do not follow any ...


5

I think the main difference even in this little example is the gain-loss asymmetry which is a known stylized fact: When you look at the big bump both time series posses your artificial one is perfectly symmetric whereas the real one takes longer for going up and then crashes in a relatively shorter time frame. This is a known phenomenon in real financial ...


5

We can talk about whether a strictly stationary or weakly stationary process might usefully describe that data. My answer to both would be yes. I also have issues with other text that people have written here. A review of mathematical definitions: A stochastic process $\{X_t\}$ is called strictly stationary if it's joint distribution function $F(X_{t}, ...


4

Simple...because you are interested in deviations from a metric, and not whether it deviates above or below. The very definition of volatility is a "measure of deviation". Squaring returns or using the absolute values just eases the calculation to arrive at a deviation measure. Otherwise volatility would have to be calculated in other ways as positive and ...


4

O-U is continuous time mean reverting process, hence used to model stationary series. It has closed form analytic solution. This allows insight into stationary processes and act like asymptotic limiting case for calculating coefficients that matter. EDIT: You can see AR(1) below $$x_{k+1} = c + a x_k + b\varepsilon_k$$ and by substituting c=θμΔt, a=−θΔt ...


4

The concept of 'mean reversion' is tricky in continuous time. Most people would call 'mean reverting' a process where the drift pulls back towards a long run mean, and I assume that this is what you also mean. Something like the drift of an OU process. However, in continuous time the 'pull' can be generated by the volatility. For example the process $$ dX_t ...


4

The point of confusion may be in thinking that a predictable price process is synonymous with a mean-reverting process while using the definitions in these papers, it's actually the opposite! In the context of these papers, a random walk would be 100% predictable: the unpredictable component of a random walk (i.e. the period specific shock which has finite ...


3

Saying that you can't analyze something as is does not make it garbage. You can't eat flour "as-is", but that doesn't mean you throw it out. In order to use "standard" analysis tools, you must first transform the series into something compatible. Some examples of such a transformation include k-th order differences or a log transformation. These ...


3

Autocorrelation is the correlation of a series with itself. Suppose $X = {X_1, X_2, X_3, ...}$ is your time series. Then the autocorrelation between $X_t$ amd $X_s$ is: $$ \frac{E[(X_t-\mu_t)(X_s-\mu_s)]}{\sigma_t \sigma_s} $$ This can be simplified quite a lot if the series you have is stationary (a common assumption), in which case the autocorrelation ...


3

The tseries package has GARCH models. Here is some simple code: library(quantmod) library(tseries) getSymbols("MSFT") ret <- diff.xts(log(MSFT$MSFT.Adjusted))[-1] arch_model <- garch(ret, order=c(0, 3)) garch_model <- garch(ret, order=c(3, 3)) plot(arch_model) plot(garch_model) ...


3

@Sergey correctly identified the problem. The explanation is that coef(model) is a vector, frame is a data.frame, and element-by-element multiplication takes place in column-major order. The shorter vector (coef(model)) is recycled along the longer vector (each column in frame). For example: frame <- data.frame(V1=1:5) frame$V2 <- 2 frame$V3 <- ...


3

Here is a possible explanation. Consider $X_t \sim N(0,1)$ and $Y_t \sim N(1,1)$. Then $(X_t)_0^n$ and $(Y_t)_0^n$ are realizations from stationary time series and I would expect the null hypothesis of stationarity not to be rejected (compatibly with the size of your test). Instead, the sample $(Z_t)_1^{2n} = (X_1, \dots, X_n, Y_1, \dots, Y_n)$ is drawn from ...


3

Let's consider the following example: the process is initialized randomly with $\pm1$ and then stays there forever. Seems stationary to me, but it would never cross its mean.


3

Ergodicity is connected to mixing, meaning there is one limiting distribution and it is used for time averages too. If you take a process in the real numbers that starts at a random value and then just stays at its initial point, it is stationary but not ergodic because there is not a unique distribution for time averages.


2

You should de-trend to whatever frequency scale you are testing. I.e. 1 min means de-trend 1 min data. Merely by moving to higher frequency data, you are eliminating much of the systematic bias present at higher scales -- as 1) you have many more samples to compare (minimizing standard error) 2) At smaller intervals, the drift component also shrinks ...


2

1.) Autocorrelation is the correlation of a time series against the lagged version of itself. 2). First autocorrelation is the correlation of the time series against the lag(1) version of itself. Let's look at the example below Period_Numbers = [1,2,3,4,5,6,7,8,9,10] Time_Series = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100] First Autocorrelation is ...


2

I think you misunderstood the definition. Be stationary does not mean not depend of the time as you can check here. (Sorry for putting an wikipedia link here as I suppose you may have read it) Another way to think is that the law any increment of the process is given by a same function of the difference of time. More precisely $\forall ~t_2\geq t_1,$ : $$\...


2

For both time-series, just plot the log returns. You will see that one is not a Random-Walk .. the S&P500 since you will get values that far beyond the normal distribution. Just watch this video by Benoit Mandelbrot (starting at 11min:54sec). Looking at both graphs, your eyes can fool you making you believe that both are generated by Random Walks...


2

Consider the following AR(1) process with i.i.d. normal errors that have zero mean and finite variance $\sigma^2>0$, $$ x_t = (1-\rho)\mu + \rho x_{t-1} + \epsilon _t$$ Now suppose $ \rho = 1/2$ and $\mu = 1$. This process does not have a unit root, and it is not mean stationary. At any point in time, the process has finite variance, although as time ...


2

Any data transformation to assure stationarity eliminates part of the signal in many cases the signal is not completely eliminated so you can still perform the required analyses but in some others as may the your case the signal is erased and the results seem to indicate your variables have lost predictible power although its predictive power may have been ...


Only top voted, non community-wiki answers of a minimum length are eligible