s-news
[Top] [All Lists]

Re: How to Sum the Lengths of Plotted Lines in a Time Series

To: Andrew White <andrew_white@hmsa.com>
Subject: Re: How to Sum the Lengths of Plotted Lines in a Time Series
From: Spencer Graves <spencer.graves@PDF.COM>
Date: Tue, 19 Aug 2003 18:03:50 -0700
Cc: "S-News List (E-mail)" <s-news@wubios.wustl.edu>
References: <8B9604D41941A14F90E094B07713F9531B773C@HON10036.corp.hmsa.com>
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02
For the total distance, if y = a vector of observations at equally spaced points in time, sum(abs(diff(y))) should give you the total length of the line; mean(abs(diff(y))) should normalize it for the number of observations.

Are you familiar with the use of autocorrelation (acf) and partial autocorrelations (pacf; function acf with type="partial") for model identification, as described, e.g., in Box, Jenkens, Reinsel (1994) Time Series Analysis, Forecasting and Control (Prentice Hall)? My preference today for basic time series analysis is to use ACF and PACF for model identification and then use state space techniques a la West and Harrison (1997) Bayesian Forecasting and Dynamic Models (Springer). There should be some relationship between your "total distance" and the ACF, but I'm not certain what.

hope this helps.  spencer graves

Andrew White wrote:
I want to develop an estimate of the "complexity" of any time series trend line in terms of its "cumulative trend-line distance".
I need help in how to calculate the "cumulative distance" or sum of lengths of 
individual lines connecting each data point to its next data point - like tracing the 
(jagged) time series plot line with your finger and measuring the total length traced.

Consider a regular time series plotted using ts.plot()

The index of complexity I am toying with would use as a reference the Minimum Length where each data point would have the same value across all time periods (observation points): a straight horizontal line. The Maximal Length would then be where maximal data value variability occurs between every adjacent data point in the series (sorta like a massive earthquake). Intermediate lengths would represent intermediate forms of time series data variability.
Obviously I need to "stabilize" the data ranges being referenced and eliminate 
influences of scale. That comes later ..

But I am stuck initially with just how to use S-Plus commands to sum the 
sequential series of plotted time series plot lengths between adjacent points 
from the starting point to the ending point.

Note: I believe this measure is different in principle than just measuring variance. For the following reason: I ran some time series test cases for 36 time periods: (1) same value repeated = straight horizontal line, (2) a steadily rising value = forms a straight angled line across the time series plot, (3) flat for half the points then steady decline, (4) max variation or seesaw between two extreme data values = maximum jaggy plot, and (5) a random series of values set by rnorm(). Now the variance of # 2 is greater than #5 (random) and yet #2 is far more regular and "less complex" in my view than the random changes in direction and length of #5.
Anyone have a method or can suggest some S-Plus standard functions to measure the 
cumulative line lengths - or get a better measure of the "complexity" of a time 
series plot-line?

Many thanks in advance.

Andy White
Andrew N. White, Ph.D. - Manager Research Unit
Financial Reporting & Medical Economics Dept.
Hawaii Medical Service Association
- Blue Cross Blue Shield of Hawaii
An Independent Licenseee of the Blue Cross and Blue Shield Association -
818 Keeaumoku Street, Honolulu, HI 96814
Ph. 808-948-5344 - Email: andrew_white@hmsa.com


--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu.  To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message:  unsubscribe s-news



<Prev in Thread] Current Thread [Next in Thread>