# Determining if a time series is random

An example time series would be the stock market, which is sometimes described as a random walk. Over time, this is clearly not the case as it has essentially gone in one direction (up) with only occasional setbacks.

I'm coming up with several characteristics that could be used to measure orderliness of a specific segment of a time series:

1. Net movement from start to finish
2. Linearity of movement
3. Length of time

In short, the larger the absolute value of the movement relative to the standard deviation of the series over similar lengths of time and the more linear the move, the more significant that segment. These characteristics could also form a kind of signature of each given segment.

Maybe the answer to this is simply that a time series whose segments don't fit a normal distribution is a non-random time series, but I'm wondering if there are methods that capture the significance of a time segment relative to #1-3 above, i.e., "how rare is this segment"?

## 2 Answers

You can run a statistical test like Augmented Dickey Fuller to check if the variable follows a random walk.
Use the adfuller function from statsmodels:

from statsmodels.tsa.stattools import adfuller

results= adfuller(df['<your_col>'])
print('p value:', results[1])
print(results)


Time series and random walks are heavy concepts not readily known by most people, what you're asking is an investment finance question pertaining to portfolio risk-management. Perhaps your question could be beneficial if also posted in the finance side of stack-overflow. I haven't seen good questions lately, this is far better than what I've seen there.

• Okay, I'll do that. Were you referring to quant.stackexchange? – SuperCodeBrah Oct 9 '19 at 16:14
• No, I actually meant money.stackexchange.com- you see; I'll try to keep it short- and try to answer why this is a heavy concept. I see this chart, and I see market-timing, some may say that they see head and shoulders- referencing tech. analysis, and others would say that past history is displayed in charts, therefore fund. analysis. This I know > Markets are efficient- meaning that if you think a price of a stock will be 40 tomorrow, it will be 40 today- so what algorithms do you use to determine these rare events? It's very hard to predict the charts patterns is my point. – Laythesmack Oct 10 '19 at 15:03
• What you're asking about encompasses a bit of CAPM, Efficient Market Theory, Modern Portfolio Theory, Risk-Aversion, and herd- investment theory among other topics. This is why I said, it was a heavy concept so finding someone that understands not only the quant side of things but can draw the right questions regarding your work cross-referenced to other theories that are tried and proven is what you need (close to a blue-unicorn if you ask me). Maybe that person is on the money site- I'm thinking someone with risk-management experience now in academia. – Laythesmack Oct 10 '19 at 15:35
• I reposted the question here: quant.stackexchange.com/questions/49131/…. Based on some of the comments, it’s not entirely a fringe question. The hard part is the jargon-dense responses. – SuperCodeBrah Oct 10 '19 at 15:51
• I think that will happen with a quant audiences, this is why I suggested the money site. I'm trying to help you so you don't go down the rabbit hole (math theories) I'm sure someone with the right insight will be able to guide you a bit better. – Laythesmack Oct 10 '19 at 16:37