Tag Info

Hot answers tagged

23

A stationary process is one where the mean and variance don't change over time. This is technically "second order stationarity" or "weak stationarity", but it is also commonly the meaning when seen in literature. In first order stationarity, the distribution of $(X_{t+1}, ..., X_{t+k})$ is the same as $(X_{1}, ..., X_{k})$ for all values of $(t, k)$. ...


10

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

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 ...


9

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] + ...


7

A very excellent discussion of stationarity as it relates to trading can be found in Sherry's (Sherrys'?) Mathematics of Technical Analysis (poorly organized, but very useful book). As he puts it, if the price changes of a stock, etc., are stationary over a time period, the underlying rules generating the price changes are effectively unchanged. The ...


7

A process is defined here and is simply a collection of random variables indexed (in general) by time. Otherwise I know the concept stated by Shane under the name of "weak stationarity", strong stationary processes are those that have probability laws that do not evolve through time. More formally let $X_t$ be a given process, then let's call $P_X$ the ...


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) ...


5

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


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 ...


4

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).


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

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 ...


4

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 ...


3

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 ...


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

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

@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

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.


2

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) ...


2

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 ...


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

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 ...


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

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 ...


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 ...


1

Write the series in the answer as $(x_t - \mu) = \rho (x_{t-1} - \mu) + \varepsilon_t$ then if $\rho=.5$ and $\varepsilon_t$ is $N(0,\sigma^2)$, $(x_t - \mu)$ is stationary with mean $0$ and variance $\frac{\sigma^2}{1-\rho}$. A time series process can have a deterministic part and a pure random part. The definition of stationarity (strict or strong or ...


1

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,$ : ...


1

you hypothesize that your data is generated by the following process: $y_t=\phi_0+\sum_{k=1}^P\phi_ky_{t-k}+\varepsilon_t$, where $\phi_k$ are your autocorrelation coefficients, and $\varepsilon_T$ - random errors. Next, you estimate your $\phi_t$ using one of the methods of estimation of autoregressive processes AR(P) of order P, e.g. see AR(P), there's no ...


1

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 ...



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