Group Abstract Group Abstract

Message Boards Message Boards

1
|
6.4K Views
|
5 Replies
|
5 Total Likes
View groups...
Share
Share this post:

Question about time series and autocorrelation function

Posted 4 years ago
POSTED BY: Alex Teymouri
5 Replies

That's an awesome solution.

I should say extracting the lag time series is very important in water engineering. Thank you so much, Rohit.

You are always great :)

POSTED BY: M.A. Ghorbani
Posted 4 years ago

Hi Alex,

The creation of additional lists can be avoided by generating the correct Spans.

list = {15, 18, 10, 13, 16, 14, 29, 55};
lag = 3;
length = Length@list

Table[list[[lag + i ;; length + i - 1]], {i, 1, 1 - lag, -1}]

Encapsulated in a function

ClearAll@lagWindow
lagWindow[list_List, lag_?Positive] /; Length@list > lag :=
  Module[{length = Length@list},
  Table[list[[lag + i ;; length + i - 1]], {i, 1, 1 - lag, -1}]]
POSTED BY: Rohit Namjoshi
Posted 4 years ago

Here is one way (not very efficient for long lists)

list = {15, 18, 10, 13, 16, 14, 29, 55};
lag = 3;

lags = Table[ArrayPad[list, {j, 0}, NA], {j, 0, lag}]
lags[[All, lag + 1 ;; Length@list]]
POSTED BY: Rohit Namjoshi
Posted 4 years ago
POSTED BY: Alex Teymouri
Posted 4 years ago

Hi Alex,

Isn't the lag n time series just this?

Istanbul[[n + 1 ;;]]
POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard