It's not clear to me what you really want. Perhaps you want "averages" of certain pre-picked points in time. Say, the average of 7AM, 11AM, 3PM, 7PM and 12midnight. Or maybe you you a way where you can pick a time, plug it into a formulae, and the average rolls out of it.

You might want to interpolate, but there are many ways of interpolating. A piece-wise linear interpolation of successive datapoints is the simplest, but it's also crude. And even then there are decisions to be made. Suppose you want the average level on 11AM, and you have datapoints on 9:15AM on day 1, 12:30 PM on day1, 8:30AM on day2 and 11:55AM on day2. You can do interpolation between the 9:15AM and 11:55AM times - they are the times closest to 11:00AM, but they are from different days. You can also first interpolate the two points of the first day, then interpolate the two points on the second day, then average.

But is linear interpolation appropriate? Many biometric measurements are supposed to vary during the day, perhaps according to a sinal wave. You can then do a better approximation of the value by taking this into account. You can even increase accuracy by doing interpolation (be it linear or something else) by including more points. But not blindly, it can also decrease the accuracy, specially if you use the "wrong" interpolation.

Alternatively, you can make a "best fit" curve using all the measurements of a day, or even all the measurements. With a best fit curve, you typically first decide what form the curve should have (a line, a parabole, a sinal wave, etc), and then from all the possible curves of that form, you find the one that minimizes some distance from your measure point. An often used distance is the sum of the squares of the distances of all the measured points to the curve. There are standard techniques for this.

4:30AM (when I get up days I go to the gym)
Man, that can't be healthy. 4:30AM is a time to say goodnight on IRC, write a final post on Perlmonks, save your days work in CVS, check to see if there's a tape in your backup unit, and to hide in your bed for that big hot thing that's about to rise the skies.

Abigail


In reply to Re: Data averages by time of day by Abigail-II
in thread Data averages by time of day by blue_cowdawg

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.