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