# How to measure the streakedness of numerical data?

Would anyone know how to use C/C++ to calculate the streakedness of data? The definition of streakedness is how many deviations away from the mean(i.e running average a numerical data streak. Thank you for your help.

[EDIT] From our company's chief software architect, here is the requirement for a statistical measure. Could someone please define a statistical formula based onour architect's definition of data streakedness? -- February 19th 2013 8:45 AM

Equal numbers are a streak. $1,2,3,3,3,4,5$ has a streak of $7$.

Case A: $1,2,3,4,5,6,7,8,9,10,11,12,13$ has a longest streak of $13$.

Case B: $1,2,3,4,5,6,7,3,8,9,10,11,12$ has a longest streak of $7$, a second smaller streak of $6$.

Case C: $1,2,3,4,5,6,7,1,2,3,4,5,6$ has a longest streak of $7$, and a second smaller streak of $6$.

Case D: $1,2,3,4,5,6,7,1,2,3,1,2,1$ has a longest streak of $7$, a second smaller streak of $3$, and a third smallest streak of $2$

Case E: $1,2,3,4,5,6,7,6,5,4,1,2,3$ has a longest streak of $7$, and a second smaller streak of $3$.

Case F: $1,2,3,4,5,6,7,6,5,4,3,2,1$ has a longest streak of $7$, and no smaller streaks.

The cases A – F are ordered in ‘most sorted to least sorted’, but all have the same length longest streak. Using the averages of streak length is not appropriate:

A: $\text{Average} = 13/1 = 13$

B: $\text{Average} = (7+6)/2 = 6.5$

C: $\text{Average} = (7+6)/2 = 6.5$

D: $\text{Average} = (7+3+2)/3 = 4$

E: $\text{Average} = (7+3)/2 = 5$

F: $\text{Average} = 7/1 = 7$

Factoring in non-streaks (counting them as 1’s):

A: $\text{Average} = 13/1 = 13$

B: $\text{Average} = (7+6)/3 = 4.3$

C: $\text{Average} = (7+6)/2 = 6.5$

D: $\text{Average} = (7+3+2+1)/4 = 3.25$

E: $\text{Average} = (7+1+1+1+3)/5 = 2.6$

F: $\text{Average} = (7+1+1+1+1+1+1)/7 = 1.85$

A variable $R$ can be used to indicate how many deviations away from the mean a particular streak is. The level of a streak can be defined not just in ($\text{integer} \times \text{deviation}$) distances from the mean but also as ($\text{integer} \times \text{fraction_of_deviation}$) distances. To accomplish this, a variable R-factor can be used. The R-factor indicates the separation between two successive R-levels in terms of a fraction of the deviation. By varying the R-factor, streaks can be ranked as required. However, the "credibility" of the streak should also be considered, and included in a ranking mechanism. The deviation within the streak is an obvious measure of how staggered the data is within the streak. A good streak should be less staggered, or in other words, have less deviation. For this reason, a very high level streak is considered to be good, even if its deviation is more than what would normally be desired. Thus, while the level $R$ influences the ranking positively, the deviation within the streak influences it negatively

-
May it be possibe for some expert to consider Chauvets' Criterion for data outliers as a statistical mesure for data streakedness? Thank you for your help.math.stackexchange.com/questions/198105/… – frankc Feb 19 '13 at 13:55
@Joni's answer "If you don't care about the streak contents you could use the sum of squares of streak lengths divided by the square of the total length. This measure would be between 0 and 1. It would be exactly 1 if the entire sequence is a single streak, slightly less if it's mostly one long streak, and 1/length if it has no streaks at all. For your cases this measure comes out as A: Average = 13²/13² = 1.0000 B: Average = (7²+6²)/13² = 0.5030 C: Average = (7²+6²)/13² = 0.5030 D: Average = (7²+3²+2²+1²)/13² = 0.3728 E: Average = (7²+1²+1²+1²+3²)/13² = 0.3609 – frankc Feb 19 '13 at 15:12
Our software architect just defined data streak length in terms of Chauvanets' Criterion. Thank you for your help. – frankc Feb 19 '13 at 20:36