No announcement yet.

RE: time-series averaging

This topic is closed.
  • Filter
  • Time
  • Show
Clear All
new posts

  • RE: time-series averaging

    John Scholz writes:

    >I would like to know if anyonehas an algorithm or source code for a
    >program that they would be willing to share which averages two or more
    >time series collected under the same experimental conditions: e.g.,
    >several gait cycles or reaches to a target under constrained conditions.
    >The program would have to run on an IBM-386 compatible computer.

    I don't have a ready-to-run program, but I could send you some Fortran
    code. My approach is as follows: first, a program called CUT is used
    to cut a series of strides (or trials) into pieces. Each stride is
    then represented by a fixed number of equidistant samples. This is
    done by the subroutine EQUISEL (see listing below). If you
    have a stride with length of 92 samples, and you want to create a
    record of 100 samples, you say:

    call EQUISEL(data_raw, 92, data_norm, 100)

    Where data_raw is an array with the raw samples. The result (time-
    normalized data) is stored in the array data_norm.

    Output of CUT is a file with all strides stored as a fixed-length
    record. These records can then be plotted for visual detection of
    abnormal strides. After that, a program AVFIL is used to create an
    average of all `normal' strides from this file. This program also
    calculates the variation between strides. This variation is
    quantified in three different ways:

    1. A time-average of the standard deviation.
    2. The CV (coefficient of variation), see paper by D.A. Winter, Human
    Movement Science 3:51-76(1984).
    3. The VR (variance ratio), see paper by M.P. Kadaba, J. Orthopaed. Res.

    I tend to prefer the VR as a measure of variability, as it is not
    affected by a DC shift of the signal. Fortran source for AVFIL
    is available.

    John Wann made a good point about suitable
    criteria for detecting begin and end of trials. In gait studies
    however, the instant of foot impact is sufficiently well-defined to
    avoid such difficulties. In my work on equine gait, I routinely
    use an accelerometer on the hoof, which provides an excellent timing

    Good luck,

    Ton van den Bogert
    University of Utrecht, Netherlands.

    subroutine equisel(x,n,xsel,nsel)
    c select nsel equidistant points from n points of array x
    c by linear interpolation
    c mapping: 1 --> 1
    c n+1 --> nsel+1
    c Input: x(n)........Raw data
    c n...........Number of samples in raw data
    c nsel........Number of samples you want in time-normalized data
    c Output: xsel(n).....Time-normalized data
    real xsel(nsel),x(n)
    double precision step,frac
    step = 1d0*n/nsel
    iptr = 1
    frac = 0d0
    do j=1,nsel
    xsel(j) = (1d0-frac)*x(iptr) + frac*x(iptr+1)
    frac = frac + step
    do while (frac .gt. 1d0)
    frac = frac - 1d0
    iptr = iptr + 1
    end do
    end do