Tag Info

Hot answers tagged

21

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


9

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

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


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

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

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

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


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

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

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


2

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


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


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


1

You can't include the levels in OLS. You will get biased coefficient and standard error estimates. Look to include this as some sort of ratio with other predictors based on theory, and test the ratio's stationarity. I can't yet imagine how this point would work but think about it. Maybe you can test the order of integration and use multiple differencing. ...


1

I would argue that this is the very definition of a non-stationary process. We know that shares outstanding are incrementally added to or removed from by the company issuing or repurchasing shares. These innovations are added to the previous outstanding share count. My first instinct would be to model this as: $$Y_i = Y_{i-1} + dX$$ Or perhaps ...


1

You can check the wikipedia page to find out "the the basic model assumptions" for the a stationary random process, and I assume "the correct reasoning on relationships" are the model that describe a random process. But intuitively speaking, if the data are sampled from a stationary random process, then you can predict the future by deductively extrapolate ...


1

In answer to your question 2, you should detrend over the entire range of the back test period. The purpose of the detrending is to satisfy/create the null hypothesis for the boot strap test (it's not strictly necessary for the permutation test). This hypothesis is that the return from your strategy is zero. To create this zero null hypthesis you have to 1) ...



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