Measuring the smoothness of time series I work on a method that gives a (noisy) estimation of brain volume over time in Alzheimer's patients.
As we know that the evolution is smooth and even mostly linear if looked at over a time frame of a few years, one way of evaluating the algorithm is to look at the smoothness or linearity of the estimated time series (brain volume over time).
This is why I'm looking for a good metric of smoothness or linearity of time series. What I've been using for now is the average R² from patient-wise linear regressions. This does reflect linearity, but it depends heavily on the sampling (it will give better results with fewer data points). Could anyone suggest a better metric?
Some details since apparently my question wasn't clear. I have an algorithm that gives a few (from one to five or six) discrete $V(t_n)$ brain volume measurements for many patients. I want to measure to which degree $V$ is close to something linear, eg. $V(t_n) = a t_n + b$ accross all patients (all patients will have different coefficients, but I want an overall measure of linearity).
I should also mention that the $t_n$ values are not regularly spaced.
One more comment
Obviously patients with one or two data points are not informative. However I want to take advantage of all the other patients. Even a patient with three data points is informative: three aligned points are much better than three completely jagged points.
 A: I think that your problem is simply overfitting - you want to have a linearity measure that isn't inflated at very small N.
Here are two candidates:


*

*Adjusted r-square.
In your case (a single regressor), that would be $R^2-\frac{1-R^2}{N-2}$

*Cross-validated $R^2$: leave out one measurement at a time. Estimate the linear model without it. Then, calculate the squared difference between the actual held out measurement and its predicted value. Repeat for all time points, add up and you'll get predicted residual sums of squares (PRESS). Next calculate SST (the variance of the measurements * N). From here you can get a predicted $R^2$:
$predicted \ R^2=1-\frac{PRESS}{SST}$
I think that the former tends to be optimistic whether the latter tends to be pessimistic. Both naturally require at least 3 measurements.
A: Although it would be better if you had described your problem mathematically, from what I read I understand that  
a) You have an estimator function that estimates the evolution of brain volume over time, say, $\hat V_t= f($data$)$ and
b) You want to measure the distance of this estimator function from the simple linear time trend $\bar V_t = a + bt$.  
So it appears that you should search the various distance measures available, like for example the Hellinger distance (which although it has been devised to measure the distance between two distributions, it can be used more generally to measure the distance between any two sets of points that can be linked pairwise).
But what I don't understand is this: why are you not satisfied with the, supported by the data as you write, simple linear estimator? Are you essentially trying to achieve a better short-term prediction performance, while maintaining as much "long-term linearity" as possible? Is this the case? 
A: Since you are computing $r^2$ for each patient $i$ and you want the following properties:

So patients with more data points will likely have a worse metric, if nothing is done.



*

*Series with more measurements should be higher weighted



My concern is that those with 3 and those with 6 should be treated in a way that does not favor one way or another



*

*Series with lesser points should also be included judiciously. 


A simple heurisic comes to mind to measure linearity across the whole dataset: Let the number of data points for each patient be $n_i$ and the total number of patients be $K$. Since you are already computing $r_i^2$ for each patient $i$, how about getting a weighted average:
$$\frac{\sum_{i=1}^{K}n_i r_i^2}{\sum_{i=1}^{K}n_i}$$
This has the property that it will give more importance to series with higher number of observations.
Instead of $n_i$ as the coefficients in the numerator and denominator above, you can use any other function of $n_i$ to address your concerns I quoted above.

Another thought: To counter the issue of ireegularly sampled observations,do the following. Fit $n_i-1$ dimensional polynomials (link1,link2) to each of the time series observations you have (as an extension of the divided differences idea by @Glen_b). Given $n_i$ algorithm outputs $\{V(t_k)\}$ at $n_i$ times $\{t_k\}$, this is just
$$
V^{\textrm{poly. approx}}(t)=\sum_{k=1}^{n_i}V(t_k)\cdot\prod_{1\leq j\leq n,j\neq k}\frac{t-t_k}{t_k-t_j}.
$$
Then, evaluate each of these polynomials at regular time locations for each patient. And then fit the lines and proceed as above. 
A: I suggest two different approaches:


*

*First of all, I have read that you suffered from sampling effects. One recommendation is using Wavelets/Fourier coefficients to obtain linearity. In many cases, there are solutions to avoid sampling effect with this tool.

*Secondly, you should try kurtosis and skewness to see the variability of the signal and smoothness.
But, if you want to see trends on your signal, the best option is using Wavelet.
A: How about doing your linear regression, then take the residual by subtracting your regression line from the data, and look at its standard deviation (SD) or median absolute deviation (MAD)? (The SD part may be basically equivalent to the R^2, I'm not sure of the math.)
The problem is the "one to five or six" part. That's not much data there, but of course the data you have is what you have. (If you had a lot more data, you could consider decomposition methods on the residual to look at the power in higher and lower frequencies.)
I thought of things like the KL-divergence or something like Alecos mentioned, but they're for differences in distributions not differences in time series, so I'm not sure they're applicable.
A: If you assume that the relationship is linear, you can use this trend estimator: $T_{n-1}=\frac{V(t_n)-V(t_{n-1})}{t_{n}-t_{n-1}}$ ,take the mean of these for each patient (which is the measure of linearity), calculate the sum of the residuals^2 (which gives an idea about how much you can trust this linearity. You can use Student t-test to measure the strength of the linearity in the same way it is used to test the strength of a trend in a linear regression in case you have a big enough sample size. 
It is easier if you have a data sample we can use . 
HTH
