Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Data averages by time of day

by Abigail-II (Bishop)
on Feb 26, 2004 at 15:39 UTC ( [id://332020]=note: print w/replies, xml ) Need Help??


in reply to Data averages by time of day

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

Replies are listed 'Best First'.
Re: Re: Data averages by time of day
by mutated (Monk) on Feb 26, 2004 at 15:51 UTC
    I question the usefullness of calculating the average. The doctor already knows what a baseline glucose level is supposed to be, I suspect he would be more intrested in viewing just a raw plot of the data over whatever period of time the tests where taken over, it should be immediately visually apparent where the spikes are, and if the glucose levels are generally below or above the norm... blue_cowdawg has your physician given you any indication on what data would be of interest to him/her?
    daN.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://332020]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-18 01:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found